Commit Graph

4305 Commits

Author SHA1 Message Date
Glenn Strauss 3b3574c5e6 [core] save pcre result state in config_pcre_match
rename data_config_pcre_exec() to config_pcre_match()
  and move logic saving pcre result state from
  config_check_cond_nocache()

split config_check_cond_nocache() into two funcs
  config_check_cond_nocache() participates in recursion
  config_check_cond_nocache_eval() evaluates the condition
2021-11-20 02:53:24 -05:00
Glenn Strauss 7ea2d40734 [core] save config regex captures only if used
save config regex captures separately only if used by url.redirect
or url.rewrite replacement directives within the condition
(or for conditions containing directives from any other module
 which calls config_capture() for its directives during init)

keep pointer to match data (cond_match_t *) in r->cond_match[]
rather than cond_match_t to reduce data copying in h2_init_stream().
h2_init_stream() copies the results for already-evaluated conditions
to avoid re-evaluating connection-level conditions for each and every
stream.  When conditions are reset, then the pointer in r->cond_match[]
is updated when the condition is re-evaluated.  (This all assumes that
HTTP/2 connection-level conditions are not unset or re-evaluated once
HTTP/2 streams begin.)
2021-11-19 20:48:05 -05:00
Glenn Strauss 04d387e37f [tests] t/test_mod needs -ldl on Debian 2021-11-18 02:31:30 -05:00
Glenn Strauss c52ea837b5 [mod_dirlisting] (experimental) json (disabled)
checkpoint (experimental) json output (disabled) from mod_dirlisting

Soliciting feedback from anyone who might write client javascript
employing json output from mod_dirlisting.  What should be changed?
2021-11-17 21:51:57 -05:00
Glenn Strauss e1ff1cc871 [core] buffer_append_string_encoded_json() 2021-11-17 21:51:57 -05:00
Glenn Strauss d85ed2a672 [mod_dirlisting] check for disabled cache at start
check for explicitly disabled cache during startup config
  (dir-listing.cache = ("max-age" => 0))
(e.g. to disable after having been enabled)
2021-11-17 21:51:57 -05:00
Glenn Strauss f350681ff0 [core] get_http_method_key() tweak 2021-11-17 21:51:57 -05:00
Glenn Strauss bab0e5d084 [tests] combine tests into test_common.c
combine common components tests into test_common.c

combine into a single executable to reduce compilation/link redundancy
2021-11-17 21:51:55 -05:00
Glenn Strauss 44a67cabcc [mod_evasive] update comment to add references
update comment to add references to other modules and mechanisms
available in lighttpd to enforce security policy
2021-11-15 11:59:18 -05:00
Glenn Strauss 8e4cf2231e [tests] t/test_mod_evasive.c 2021-11-15 11:59:18 -05:00
Glenn Strauss 4288375a23 [mod_evasive] smaller funcs for testing 2021-11-15 11:59:18 -05:00
Glenn Strauss 3034147e51 [tests] remove unused mod from tests/lighttpd.conf
remove unused module mod_userdir from tests/lighttpd.conf
(module is tested in src/t/test_mod_userdir.c)
2021-11-15 11:59:18 -05:00
Glenn Strauss 251f97bf4f [tests] t/test_mod_alias.c 2021-11-15 11:59:18 -05:00
Glenn Strauss 9b3fa6eb2b [tests] t/test_mod now runs all t/test_mod_*.c
combine into a single executable to reduce compilation/link redundancy
2021-11-15 11:59:16 -05:00
Glenn Strauss 05dc3d123a [core] better asm for binary num to ascii string
compiler optimizers generally convert div to an equivalent mul,
though not always optimally for modulus (%).  In places where
lighttpd is using both quotient and remainder, calculate the
remainder from the quotient.

x-ref: inspiration:
  https://lemire.me/blog/2019/02/08/faster-remainders-when-the-divisor-is-a-constant-beating-compilers-and-libdivide/
  https://lemire.me/blog/2019/02/20/more-fun-with-fast-remainders-when-the-divisor-is-a-constant/
2021-11-12 17:56:38 -05:00
Glenn Strauss 57c0859fd7 [core] uint_fast32_t tweaks
use uint_fast32_t in a few more places, where it yields better asm
2021-11-12 17:56:38 -05:00
Glenn Strauss 741513ecd1 [mod_ssi] merge mod_ssi_expr.c into mod_ssi.c
isolate this ancient relic
2021-11-12 17:56:38 -05:00
Glenn Strauss 457362cbe3 [mod_ssi] remove mod_ssi parser generator file 2021-11-12 17:56:38 -05:00
Glenn Strauss 43c5093a20 [mod_ssi] fix ancient bugs; replace cond parser 2021-11-12 17:56:38 -05:00
Glenn Strauss 0d9a8ed0aa [mod_ssi] 0-init ssi_val_t in ssi_ctx_t 2021-11-12 17:56:38 -05:00
Glenn Strauss adf2f816df [tests] mod_ssi tests moved to src/t/test_mod_ssi
remove mod_ssi Perl tests now performed by src/t/test_mod_ssi
2021-11-12 17:56:38 -05:00
Glenn Strauss 699209103c [core] use ck_assert() in vector.[ch] 2021-11-07 16:46:20 -05:00
Glenn Strauss be82f3d2e1 [doc] improve sample configs 2021-11-05 11:53:57 -04:00
Glenn Strauss 55d787cd55 [doc] expand vhosts.template 2021-11-05 06:52:45 -04:00
Istiak Ferdous 299220ac0d [doc] improve sample configs
(commit msg edited by gstrauss)
2021-11-05 06:37:46 -04:00
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
2021-11-05 04:48:25 -04:00
Glenn Strauss 9974b57aa5 [core] run plugin cleanup hooks in reverse
run plugin cleanup hooks in reverse to balance ctor/dtor-like plugin
behaviors
2021-11-05 04:48:25 -04:00
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)
2021-11-05 04:48:25 -04:00
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
2021-11-04 05:49:39 -04:00
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
2021-11-04 05:41:02 -04:00
Glenn Strauss fe7d5a762d [core] libev EV_ERROR conflicts with kqueue
libev EV_ERROR conflicts with kqueue sys/event.h EV_ERROR
2021-11-04 05:32:33 -04:00
Glenn Strauss ec50657efe [mod_cgi] check fd-to-cgi not -1 before close
sanity check
2021-11-04 05:03:08 -04:00
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
2021-11-04 03:15:02 -04:00
Glenn Strauss 9cdb812c96 [core] use TCP_CORK w/ TLS if cq length > 16k
use TCP_CORK (on Linux) with TLS if cq length > 16k
2021-11-03 11:48:14 -04:00
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
2021-11-03 11:45:54 -04:00
Glenn Strauss 0f51b3728a [core] fdevent_fdnode.c separate from fdevent.c 2021-11-02 02:58:03 -04:00
Glenn Strauss 7113dcb49b [core] merge fdevent impls into fdevent_impl.c 2021-11-02 02:54:01 -04:00
Glenn Strauss ec52917755 [core] fdevent_impl.c separate from fdevent.c 2021-11-01 11:37:27 -04:00
Glenn Strauss b7a8fd468f [core] fdevent_socket_nb_cloexec_init()
fdevent_socket_nb_cloexec_init() separate from fdevent_init()
2021-11-01 10:34:21 -04:00
Glenn Strauss 84449e1497 [tests] t/test_mod_ssi 2021-11-01 05:46:20 -04:00
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
2021-10-30 15:10:08 -04:00
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.
2021-10-29 23:56:05 -04:00
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
2021-10-29 10:19:36 -04:00
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
2021-10-29 10:15:02 -04:00
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
2021-10-29 08:15:41 -04:00
Glenn Strauss 1540fdeab9 - next is 1.4.62 2021-10-28 19:29:08 -04:00
Glenn Strauss 3cf695d34b [doc] NEWS 2021-10-28 18:56:50 -04:00
Glenn Strauss e8eac0c2ad [core] chunkqueue_small_resp_optim() comment 2021-10-28 17:58:06 -04:00
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
2021-10-28 02:03:22 -04:00
Glenn Strauss ac9c9935a2 [multiple] add assert after malloc in two spots
add missing assert after malloc in two spots to detect malloc failure
(unlikely)
2021-10-27 18:04:20 -04:00