Commit Graph

5089 Commits

Author SHA1 Message Date
Glenn Strauss d59bee7bda [scons] include mod_h2 in static builds (fixes #3224)
patch needed since lighttpd 1.4.71, where mod_h2 is a standalone module
by default, rather than previous of lighttpd having h2.c built-in to the
lighttpd base executable.

x-ref:
  "mod_h2 is missing in scons fullstatic build"
  https://redmine.lighttpd.net/issues/3224
2023-09-20 22:05:12 -04:00
Glenn Strauss 9ea82d4184 [mod_webdav] reject non-identity Content-Encoding
mod_webdav currently does not handle client Content-Encoding
of request bodies (besides the default: "identity")

x-ref:
  Hypertext Transfer Protocol (HTTP) Client-Initiated Content-Encoding
  https://www.rfc-editor.org/rfc/rfc7694.html
  https://www.rfc-editor.org/rfc/rfc9110#field.content-encoding
2023-09-19 01:45:33 -04:00
Glenn Strauss 2328eccbad [mod_dirlisting] send 103 Early Hints only for h2+
paranoia: do not send 103 for HTTP/1.x; only for HTTP/2 +

x-ref:
  https://www.rfc-editor.org/rfc/rfc8297.html#section-3
2023-09-18 01:19:10 -04:00
Glenn Strauss 66349e281f [core] add config option to reject pathinfo
(renamed w/ '-' instead of '_' for consistency with other feature flags)

global setting; default enabled to preserve existing behavior

If disabled, 404 Not Found is returned if request processing reaches the
step to check filesystem and path, including pathinfo, does not exist.
  server.feature-flags += ("server.http-pathinfo" => "disabled")

Note: this global feature is separate from static-file.disable-pathinfo,
which only affects requests not handled by any other module, and finally
handled by mod_staticfile.
2023-09-14 03:24:33 -04:00
Glenn Strauss d7a9c86294 [mod_magnet] lighty.c.readlink() (fixes #3223)
note: the result *is not* cached inside lighttpd

(*unlike* lighty.c.stat() which uses lighttpd internal stat_cache)

x-ref:
  "Add readlink to lighty.c.* library functions"
  https://redmine.lighttpd.net/issues/3223
2023-09-14 03:24:31 -04:00
Glenn Strauss eb0a2f9a7d [core] _WIN32 fs_win32_readlinkUTF8() (#3223)
x-ref:
  "Add readlink to lighty.c.* library functions"
  https://redmine.lighttpd.net/issues/3223
2023-09-14 03:24:25 -04:00
Glenn Strauss b0369b0dbd [multiple] use splaytree_insert_splayed() 2023-09-11 12:49:21 -04:00
Glenn Strauss 0523c65ad8 [core] splaytree: splaytree_insert_splayed() 2023-09-11 12:48:02 -04:00
Glenn Strauss 5f1b0a1ec2 [multiple] use splaytree_delete_splayed_node() 2023-09-11 12:03:16 -04:00
Glenn Strauss 21f6343e00 [core] splaytree: splaytree_delete_splayed_node() 2023-09-11 11:57:53 -04:00
Glenn Strauss 1eb60deb9f [mod_openssl] replace deprecated openssl funcs
replace deprecated openssl funcs reported when
  #define OPENSSL_NO_DEPRECATED
2023-09-10 23:56:21 -04:00
Glenn Strauss f7f800c5cc [mod_openssl] disable DH auto if DHParameters set
disable DH auto (SSL_CTX_set_dh_auto() with OpenSSL >= 3.0.0)
if "DHParameters" is set in ssl.openssl.ssl-conf-cmd

x-ref:
  "Lighttpd disregards ssl.dh-file setting"
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1040525
2023-09-10 23:44:07 -04:00
Glenn Strauss 98732c3576 [h2] comment struct h2con h2_sid member is unused 2023-09-10 23:41:21 -04:00
Glenn Strauss c7d3236883 [multiple] use splaytree_splay_nonnull()
use splaytree_splay_nonnull() when pruning splay_tree
2023-09-10 23:39:39 -04:00
Glenn Strauss 01a8084e80 [core] stat_cache: stat_cache_sptree_ndx()
code reuse for hashing value and querying splay_tree
2023-09-10 23:38:49 -04:00
Glenn Strauss 7988a4b7ad [core] splaytree: splaytree_splay_nonnull()
splaytree_splay_nonnull() for operation on non-null splay_tree

inline func splaytree_splay() to short-circuit if tree already splayed
2023-09-10 23:35:57 -04:00
Glenn Strauss 75070ba693 [core] splaytree: compare keys directly 2023-09-10 15:32:32 -04:00
Glenn Strauss b7eeb1d992 [core] splaytree: use all 32-bits of hash value 2023-09-10 15:32:32 -04:00
Glenn Strauss acff6cd34b [core] stat_cache_refresh_entry()
stat_cache_refresh_entry() file-scoped static support func separate from
stat_cache_get_entry()

rewrite stat_cache_get_entry() to avoid code repetition
2023-08-17 05:42:36 -04:00
Glenn Strauss a611e8b242 [core] show_features() show inotify or kqueue
show_features() show inotify or kqueue when present
2023-08-15 00:52:56 -04:00
Glenn Strauss 52a509ff2b [core] add config opt to send GOAWAY for bad auth
add global config opt to send GOAWAY for invalid auth
(adds cost to and reduces speed of brute force auth password attacks)

global setting; default enabled to preserve existing behavior

Disable with:
  server.feature-flags += ("auth.http-goaway-invalid-creds" => 0)
for networks with proxies where multiple requests from *different* clients
are multiplexed on the same h2 connection to lighttpd.
2023-08-13 17:16:06 -04:00
Glenn Strauss 7dddbc9960 [core] mark some cold routines noinline
mark some cold routines noinline for better asm register usage
and to slightly reduce code size when compiled optimized.
2023-08-13 13:13:00 -04:00
Glenn Strauss 854503631d [core] expand mimetype.assign builtin defaults
expand mimetype.assign builtin defaults with common media types for web
2023-08-12 19:59:54 -04:00
Glenn Strauss 44d311b24a [core] add config option to reject pathinfo
global setting; default enabled to preserve existing behavior

If disabled, 404 Not Found is returned if request processing reaches the
step to check filesystem and path, including pathinfo, does not exist.
  server.feature-flags += ("server.http_pathinfo" => "disabled")

Note: this global feature is separate from static-file.disable-pathinfo,
which only affects requests not handled by any other module, and finally
handled by mod_staticfile.
2023-08-12 19:59:54 -04:00
Glenn Strauss 0fdf13a268 [core] http_response_304(), http_response_412()
adjustments for RFC9110 handling of Content-Length with 304 Not Modified

x-ref:
  https://www.rfc-editor.org/rfc/rfc9110#name-content-length
2023-08-12 19:59:54 -04:00
Glenn Strauss 73f3c7f2d4 [mod_deflate] do not compress any 1xx status
1xx status should not reach mod_deflate, but if any do, do not compress
2023-08-12 19:59:54 -04:00
Glenn Strauss b9ec84f06f [core] use different getxattr() prototype on MacOS
(thx sevan)

x-ref:
  https://github.com/mistydemeo/tigerbrew/pull/917
2023-08-12 19:59:54 -04:00
Sam James a466965e07 [meson] Fix 'getoption' meson typo
Bug: https://bugs.gentoo.org/905219

x-ref:
  https://github.com/lighttpd/lighttpd1.4/pull/127

github: closes #127
2023-08-12 19:59:54 -04:00
Glenn Strauss 2b644c3148 [core] http_response_prepare() tweaks
tighten some branch selection
update some comments
2023-08-12 19:59:54 -04:00
Glenn Strauss 80183e741a [core] http_response_physical_pathinfo()
isolate pathinfo calculation to separate function; add comments
2023-08-11 14:38:03 -04:00
Glenn Strauss 7c6fc430cb [core] h2_process_streams() simpler loop to retire
[core] h2_process_streams() simpler loop to retire streams
2023-08-08 23:38:20 -04:00
Glenn Strauss 4343c635ce [core] tighten h2_process_streams()
(possible since recent change to add LIGHTTPD_DEBUG_REQUEST_SET_STATE)
2023-08-08 23:12:46 -04:00
Glenn Strauss d91ef120bc [core] yield writing large HTTP/1.x on slow device
yield writing large HTTP/1.x TLS responses on slow, embedded devices
in order to give other connections a better chance.  (Slow, embedded
devices performing TLS encryption might be slower than network speed.)
2023-08-08 23:04:15 -04:00
Glenn Strauss 2da808fced [core] remove connection_handle_write HTTP/1.x opt
remove connection_handle_write() HTTP/1.x state change minor optim which
does not apply to HTTP/2 or later use of connection_handle_write(), and
move an HTTP/2 check (okay to apply to HTTP/1.x) into the underlying
connection_write_chunkqueue()
2023-08-08 22:25:59 -04:00
Glenn Strauss 6ce358f555 [core] optim for non-throttle writes 2023-08-08 19:15:10 -04:00
Glenn Strauss 22c2f3bbb7 [core] reset connection-level state at con level
clean up some HTTP/1.x code assumptions before HTTP/2 support added
2023-08-08 19:15:10 -04:00
Glenn Strauss 7db6ebebdc [core] short-circuit connection_state_machine_loop
short-circuit connection_state_machine_loop() outer loop where possible
2023-08-08 19:15:10 -04:00
Glenn Strauss 82ae5070fc [core] dev-only internal request state debugging
move request state debugging behind LIGHTTPD_DEBUG_REQUEST_SET_STATE

debug.log-state-handling w/ #define LIGHTTPD_DEBUG_REQUEST_SET_STATE
2023-08-08 19:15:10 -04:00
Glenn Strauss 1fdf2b29d1 [core] warn dynamic mods listed before staticfile
warn if dynamic modules listed before mod_staticfile in server.modules
2023-08-03 01:08:38 -04:00
Glenn Strauss 140c6e31a8 [core] reject uppercase in unrecognized HTTP/2 hdr
strictly validate and reject uppercase in unrecognized HTTP/2 header
2023-08-03 00:15:30 -04:00
Glenn Strauss d71fc70c8d [core] reject empty Content-Length for HTTP/1.x
(thx kenballus)

x-ref:
  "reject empty Content-Length header for HTTP/1.x"
  https://redmine.lighttpd.net/issues/3219
2023-08-03 00:15:30 -04:00
Glenn Strauss a30858452e [core] disable keep-alive if HTTP/1.1 CL and TE
disable keep-alive and close connection after servicing request
if HTTP/1.1 Content-Length and Transfer-Encoding: chunked are
received in the same HTTP/1.1 request.

x-ref:
  RFC9112 HTTP/1.1
  https://httpwg.org/specs/rfc9112.html#rfc.section.6.1.p.15
  "A server MAY reject a request that contains both Content-Length
   and Transfer-Encoding or process such a request in accordance
   with the Transfer-Encoding alone. Regardless, the server MUST
   close the connection after responding to such a request to
   avoid the potential attacks."
2023-08-02 16:07:40 -04:00
Glenn Strauss 0558138ce9 [build] packdist.sh now produces .md for www.l.n 2023-08-01 04:12:39 -04:00
Glenn Strauss d8239801cd [core] attempt to quiet coverity warning 2023-07-29 17:07:21 -04:00
Glenn Strauss 6b06de447d [tests] test_http_range.c
add some tests for http_range.c; more needed
2023-07-29 16:49:34 -04:00
Glenn Strauss 75c3d35698 [core] allow larger number of Ranges if sorted
Protocols like zchunk and zsync may try to send a large number of Ranges
in a single HTTP request.  Track if ranges are sorted and allow larger
number of ranges if the list of ranges is already sorted ascending.

If unsorted ranges are encountered, the limit remains 10 ranges due to
the non-linear cost to detect overlapping ranges or other range attacks.
2023-07-29 16:49:34 -04:00
Glenn Strauss 0f30a368c7 [core] optimize for non-Range requests
(optimize for code size to save a few bytes, though cold marking on
http_range_process() could be removed for the minimal cost of some
bytes in the binary size)
2023-07-29 16:49:34 -04:00
Glenn Strauss 2933119ccd [CI] ci-build.sh re-enable additional dependencies
build additional modules now that dependencies have been added to images
2023-07-29 16:49:34 -04:00
Glenn Strauss 22a51c2b3c [CI] remove maxminddb from autobuild,cmake; let rest build 2023-07-28 00:10:09 -04:00
Glenn Strauss 49a7ca19b1 [CI] ci-build.sh: fix typo --with-pam 2023-07-28 00:05:48 -04:00