Commit Graph

4282 Commits (55d787cd5520376074326cdb22be4274c3c886ca)
 

Author SHA1 Message Date
Glenn Strauss 55d787cd55 [doc] expand vhosts.template 2 years ago
Istiak Ferdous 299220ac0d [doc] improve sample configs
(commit msg edited by gstrauss)
2 years ago
Glenn Strauss feb9b0c4a7 [core] fix removal of server.pid-file when testing (fixes #3115)
(thx dinoex)

fix removal of server.pid-file when testing config with lighttpd -tt
(regression in lighttpd 1.4.60, 1.4.61)

x-ref:
  "Test the configuration file while lighttpd is running."
  https://redmine.lighttpd.net/issues/3115
2 years ago
Glenn Strauss 9974b57aa5 [core] run plugin cleanup hooks in reverse
run plugin cleanup hooks in reverse to balance ctor/dtor-like plugin
behaviors
2 years ago
Glenn Strauss 8c7b86a316 [tests] reenable test_mod_ssi in cmake
(Instead, workaround added for libtool)
(There must be better ways to do this, but I don't know them right now)
2 years ago
Glenn Strauss d1f4bc98b9 [tests] disable test_mod_ssi in cmake (temporary)
disable test_mod_ssi in cmake (temporary) until include paths updated
or dependency added for the generated ssi parser header and impl
2 years ago
Glenn Strauss e93093422c [tests] disable test_mod_ssi in cmake (temporary)
disable test_mod_ssi in cmake (temporary) until include paths updated
or dependency added for the generated ssi parser header and impl
2 years ago
Glenn Strauss fe7d5a762d [core] libev EV_ERROR conflicts with kqueue
libev EV_ERROR conflicts with kqueue sys/event.h EV_ERROR
2 years ago
Glenn Strauss ec50657efe [mod_cgi] check fd-to-cgi not -1 before close
sanity check
2 years ago
Glenn Strauss 8b10f94c07 [core] warn if dynamic modules before mod_auth
warn if known dynamic modules listed before mod_auth in server.modules

e.g. mod_auth must be listed before mod_fastcgi in server.modules
     for fastcgi.server = ( "mode" => "authorizer" ) to work properly
2 years ago
Glenn Strauss 9cdb812c96 [core] use TCP_CORK w/ TLS if cq length > 16k
use TCP_CORK (on Linux) with TLS if cq length > 16k
2 years ago
Glenn Strauss b376934b67 [core] close backend socket fds more quickly
(thx ThomasDevoogdt)

close backend socket fds more quickly by polling with zero timeout when
there are pending fds scheduled to be closed after the next poll.

x-ref:
  "Slow request handling in Lighttpd 1.4.60"
  https://redmine.lighttpd.net/boards/2/topics/10063
2 years ago
Glenn Strauss 0f51b3728a [core] fdevent_fdnode.c separate from fdevent.c 2 years ago
Glenn Strauss 7113dcb49b [core] merge fdevent impls into fdevent_impl.c 2 years ago
Glenn Strauss ec52917755 [core] fdevent_impl.c separate from fdevent.c 2 years ago
Glenn Strauss b7a8fd468f [core] fdevent_socket_nb_cloexec_init()
fdevent_socket_nb_cloexec_init() separate from fdevent_init()
2 years ago
Glenn Strauss 84449e1497 [tests] t/test_mod_ssi 2 years ago
Glenn Strauss 98ba0310c4 [core] explicitly include sys/cdefs.h
<sys/cdefs.h> might not be included in standard headers by musl libc

x-ref:
  https://github.com/void-linux/void-packages/pull/33330/files#r725060227
  https://github.com/void-linux/void-packages/pull/33330/files#r725060227
2 years ago
Glenn Strauss c29268cd9e [core] remove redundant asserts
buffer_append_strftime() requires a non-NULL const string for format

buffer_append_string_encoded() and buffer_append_string_c_escaped()
both will handle encoding a 0-length string.  Since a 0-length string
is not expected, do not special-case it.  C type buffer_encoding_t
expects a constant value to be passed, so encoding map is not NULL.
2 years ago
Glenn Strauss 563eaea00d [core] 'struct log_error_st' -> 'log_error_st'
typedef redefinitions may cause issues with older compilers

(The intention behind the decls and defines were done to reduce the
 number of unrelated lines modified for the transition to fdlog_st)

x-ref:
  https://trac.macports.org/ticket/63667
  https://github.com/macports/macports-ports/pull/12658
2 years ago
Glenn Strauss d361f9cca0 [core] clean up fdlog_st and log_error_st decls
typedef redefinitions may cause issues with older compilers

(The intention behind the decls and defines were done to reduce the
 number of unrelated lines modified for the transition to fdlog_st)

x-ref:
  https://trac.macports.org/ticket/63667
  https://github.com/macports/macports-ports/pull/12658
2 years ago
Glenn Strauss 584a69c4ae [mod_alias] fix use-after-free bug (fixes #3114)
(thx LoneFox)

bug introduced in 62a874df in lighttpd 1.4.59

x-ref:
  "Use-after-free bug in mod_alias"
  https://redmine.lighttpd.net/issues/3114
2 years ago
Glenn Strauss 1540fdeab9 - next is 1.4.62 2 years ago
Glenn Strauss 3cf695d34b [doc] NEWS 2 years ago
Glenn Strauss e8eac0c2ad [core] chunkqueue_small_resp_optim() comment 2 years ago
Glenn Strauss 90f062cb07 [core] add HTTP/2 check resp finished w/ empty cq (#3111)
connection_handle_write_state() call to subrequest handler might set
r->resp_body_finished, but we need to check if r->write_queue is empty
before changing state from CON_STATE_WRITE to CON_STATE_RESPONSE_END

(If r->write_queue was already empty when the subrequest handler marked
 resp_body_finished, connection_state_machine_h2() could miss changing
 the request state to CON_STATE_RESPONSE_END)

x-ref:
  "HTTP/2 requests sometimes take very long (missing last chunk)"
  https://redmine.lighttpd.net/issues/3111
  "Slow request handling in Lighttpd 1.4.60"
  https://redmine.lighttpd.net/boards/2/topics/10063
2 years ago
Glenn Strauss ac9c9935a2 [multiple] add assert after malloc in two spots
add missing assert after malloc in two spots to detect malloc failure
(unlikely)
2 years ago
Glenn Strauss 7edb1956f3 [mod_auth] clear crypt() output if len >= 13
crypt() static output buffer is cleared upon next call to crypt(),
but clear output buffer anyway since next call to crypt() might be
much later.  Only clear crypt() output if length >= 13, since if
there is an error in crypt(), 'man crypt' warns:

"Some implementations of crypt, upon error, return an invalid hash that
is stored in a read-only location or only initialized once, which means
that it is only safe to erase the buffer pointed to by the crypt return
value if an error did not occur."
2 years ago
Glenn Strauss a067d99fa0 [core] chunkqueue_small_resp_optim if resp < 16k
(adjusted down from 32k after some basic benchmarking using weighttp)
2 years ago
Glenn Strauss 9a442b5555 [core] tighten chunkqueue_small_resp_optim() 2 years ago
Glenn Strauss 92cdf84951 [doc] uncomment mod_auth load in conf.d/auth.conf
uncomment mod_auth load in conf.d/auth.conf to match other conf.d/*
2 years ago
Glenn Strauss 41564a7e92 [core] tighten chunkqueue_mark_written; better asm
chunkqueue_mark_written() also removes finished chunks from beginning of
chunkqueue instead of separate call to chunkqueue_remove_finished_chunks
2 years ago
Glenn Strauss 3964a6ac39 [core] pwritev w/ chunkqueue_steal_with_tempfiles
use pwritev(), where available, with chunkqueue_steal_with_tempfiles()

The initial write to tempfiles (when response initially grows too
large in memory) can be multiple MEM_CHUNKs, so attempt to use
single pwritev() syscall
2 years ago
Glenn Strauss 5c18891a94 [build] check for preadv(), pwritev() 2 years ago
Glenn Strauss 907ec27737 [core] tighten chunkqueue_steal* code; better asm 2 years ago
Glenn Strauss 9466afd909 [core] remove redundant checks in same context 2 years ago
Glenn Strauss f71b048160 [multiple] warn deprecated mods slated for removal
issue warning to error log for deprecated modules slated for removal
2 years ago
Glenn Strauss fe055165d8 [mod_ajp13,mod_fastcgi] recv_parse smaller funcs
break *_recv_parse() into a pair of slightly smaller funcs
2 years ago
Glenn Strauss c22a56fe3b [core] restart dead proc on connect error if local
restart dead proc on connect error only if proc started by lighttpd
2 years ago
Glenn Strauss 18ed51f06d [mod_proxy] Length Req if proxy forcing HTTP/1.0
return 411 Length Required if mod_proxy configured to force HTTP/1.0
to backend and configured to stream request body, and client request
has a request body but did not provide Content-Length.
2 years ago
Glenn Strauss 1acf9db7d3 [mod_ajp13,mod_fastcgi] check resp w/ content len
limit response body from mod_ajp13 and mod_fastcgi to Content-Length,
if Content-Length is provided in response headers; discard excess
2 years ago
Glenn Strauss e78cd76511 [core] combine more dup header processing code
(pedantically, repeating HTTP_HEADER_HTTP2_SETTINGS should be an error,
 but ignore the duplicate if it matches the value of the first one seen)
2 years ago
Glenn Strauss 7daafadb9d [core] allow debug.log-state-handling in condition
allow debug.log-state-handling to be enabled in config conditions,
even though the connection and request may already have begun
(and therefore not logging state changes which already occurred)

(also, minor additional structure cleanups made in the vicinity)
2 years ago
Glenn Strauss 23b94856b1 [mod_nss] quiet trace for PR_END_OF_FILE_ERROR
quiet trace for PR_END_OF_FILE_ERROR
unless debug.log-ssl-noise = "enable"

x-ref:
  https://redmine.lighttpd.net/issues/3111#note-12
2 years ago
Glenn Strauss 6fd98f89fa [core] clear shared log buffer after writes
avoid repeating error trace when all fdlog_t are periodically flushed
2 years ago
Glenn Strauss 92f2ac9b3f [core] thwart h2 request tunnelling
Existing behavior: strict header parsing, strict host parsing, and
basic url normalization are enabled by default in lighttpd, and
protect against h2 request tunnelling attempts using invalid chars
in headers.

Keeping strict parsing settings enabled is strongly recommended.

If any are explicitly disabled in lighttpd.conf, then this patch takes
steps to thwart h2 request tunnelling.

x-ref:
  "HTTP/2: The Sequel is Always Worse"
  https://portswigger.net/research/http2
2 years ago
Glenn Strauss 438dadde52 [core] separate funcs to check for valid chars
separate funcs to check for valid chars in headers
2 years ago
Glenn Strauss e8a6ed6e35 [core] thwart h2c smuggling when Upgrade enabled
Existing behavior: mod_proxy *does not* forward Upgrade header
unless explicitly enabled in lighttpd.conf (default: not enabled)
  (proxy.header += ("upgrade" => "enable"))

mod_cgi previously used to forward Upgrade request header, but would
remove Upgrade response header if cgi.upgrade was not explicitly enabled
  (cgi.upgrade = "enable")

This patch thwarts h2c smuggling when lighttpd.conf has also been
explicitly configured to pass "Upgrade" request header

x-ref:
  "h2c Smuggling: Request Smuggling Via HTTP/2 Cleartext (h2c)"
  https://labs.bishopfox.com/tech-blog/h2c-smuggling-request-smuggling-via-http/2-cleartext-h2c
2 years ago
Glenn Strauss 97eed364ff [mod_auth] revert adjustment to auth passwd cache (#3112)
revert b1d1202a which is no longer needed with recent update to
ck_memeq_const_time()

x-ref:
  https://redmine.lighttpd.net/issues/3112
  "mod_auth cache password doesn't match"
2 years ago
Glenn Strauss 9d05b648ee [core] make ck_memeq_const_time() more generic (#3112)
make ck_memeq_const_time() more generically reusable

remove implementation requirements that strings be '\0' terminated,
or at least have an initialized byte following each string (s[len])

x-ref:
  https://redmine.lighttpd.net/issues/3112
  "mod_auth cache password doesn't match"
2 years ago