Commit Graph

4601 Commits (f86b448799fc7f55274a1d61583ff3d390f58e0b)
 

Author SHA1 Message Date
Glenn Strauss 2e04e3b109 [mod_magnet] lighty.r.req_item[] accessors
access (request_st *) struct members and statistics more directly,
e.g. integers values, as compared to lighty.r.req_attr[] strings
1 year ago
Glenn Strauss 2f233900be [mod_magnet] tighten magnet_env_set()
split remote addr and remote port out into magnet_env_set_raddr_by_id()
1 year ago
Glenn Strauss 81cd2f36b6 [mod_magnet] expose r->state to lua scripts
lighty.r.req_attr["request.stage"]  ("stage", not "state")
1 year ago
Glenn Strauss 5e0d82dc8f [core] reusable code for r->state strings
convenience macros/functions for display purposes

(historical labels from mod_status are preserved for compatibility)
1 year ago
Glenn Strauss 5471a4ba55 [mod_status] reusable code for r->state strings 1 year ago
Glenn Strauss beac48541d [mod_magnet] tighten magnet_env_get_buffer_by_id()
split server addr and server port out into magnet_env_get_laddr_by_id()
1 year ago
Glenn Strauss 5447bd5ff7 [mod_magnet] reduce magnet_env_get_id() scanning 1 year ago
Glenn Strauss 14ddf19c97 [mod_accesslog] do not double-count hdr len in %I
do not double-count HTTP/2 stream request header len in %I

(overlooked and should have been adjusted in 8fc8ab89)
1 year ago
Glenn Strauss beb029d6e2 [mod_magnet] lighty.server.* table w/ new function
(experimental)

(new interfaces are unstable and may change)
1 year ago
Glenn Strauss 1118a8af61 [mod_magnet] magnet_script_setup_global_state() fn 1 year ago
Glenn Strauss b65a7d7642 [mod_magnet] magnet_plugin_stats_table() fn 1 year ago
Glenn Strauss 14bfa016f1 [core] sketch support for abstract sockets
(experimental; untested)

Note: abstract sockets do not require filesystem access and can not be
protected using filesystem permissions; abstract sockets are accessible
by any process in the same network namespace on the same machine.

Abstract sockets can be passed to lighttpd via systemd socket activation
mechanism, via xinetd, or any other process which creates an abstract
socket and passes it to lighttpd.  Abstract sockets can also be
configured in lighttpd.conf using a backslash-escaped double-quoted
string, where CTL and chars with high bit set are backslash-escaped into
"\\xFF", with "\\x" followed by two-byte hex encoding (e.g. "FF") for
each escaped char, e.g. "\\x00abstract-socket"
1 year ago
Glenn Strauss 609f9209c8 [mod_extforward] unix domain socket pedantic chks
unix domain socket pedantic checks when received via HAProxy PROXY
protocol (and should already be enabled only from trusted upstreams)

UNIX_PATH_MAX might be different sizes in some OS, and might not be
defined.  It is 108 on Linux, but might be 104 on BSD, MacOS, so be
a bit more pendantic about checking structure sizes and assigning
the path to the sock_addr.
1 year ago
Glenn Strauss 2bde52475a [mod_magnet] no local server port on unix domain
no local server port on unix domain socket
1 year ago
Glenn Strauss 9aeed2a4b8 [mod_status] fix counting of HTTP/2 bytes written
remove usused accounting
simplify to use (64-bit) off_t for counting, but preserve doubles for
  pretty-printing numbers with decimal point and size suffix
1 year ago
Glenn Strauss ddb7f5640d [core] remove func decls duplicated in plugin.h 1 year ago
Glenn Strauss 083f42b999 [mod_setenv] cleanup user-provided hdr sloppiness
cleanup user-provided request and response headers
- remove leading and trailing whitespace from value
- replace with ' ' line ends following ',' in value
- warn if header value contains '\r' or '\n'
1 year ago
Glenn Strauss f1b6dc3f54 [mod_status] con->h2 instead of r->http_version
check con->h2 instead of r->http_version

(additional safeguard for #3152)

x-ref:
  "Random Segfaults with version 1.4.64 w/ mod_sockproxy and ALPN h2"
  https://redmine.lighttpd.net/issues/3152
1 year ago
Glenn Strauss 7e4a3215a3 [mod_magnet] rewrite lighty.r as table of userdata
rewrite lighty.r as table of methods implemented as userdata
(enable lua r table to potentially be reusable with other requests,
 instead of relying on global table to obtain (request_st *)r)

various optimizations to reduce instruction memory use
1 year ago
Glenn Strauss 570612afa6 [mod_magnet] set script env in func first upvalue
set script env in first upvalue (_ENV upvalue) for func once,
upon script init, since script-env table is preserved and reused
(and script-env is cleared between script invocations)
1 year ago
Glenn Strauss 19569ab916 [core] default server.max-keep-alive-requests 1000
change default server.max-keep-alive-requests = 1000 to adjust
to increasing HTTP/2 usage and to web2/web3 application usage

prior default: server.max-keep-alive-requests = 100
1 year ago
Glenn Strauss 23409e75af [core] connection_state_machine_h2 only if con->h2
call connection_state_machine_h2() only if con->h2 has been initialized

(additional safeguard for #3152)

x-ref:
  "Random Segfaults with version 1.4.64 w/ mod_sockproxy and ALPN h2"
  https://redmine.lighttpd.net/issues/3152
1 year ago
Glenn Strauss c183b8875b [core] delay response to http auth invalid creds
server.feature-flags += ("auth.delay-invalid-creds" => "enable")

The default is enabled.  This feature delays a response to bad http auth
(invalid username or password) to the next second, so up to 1 sec delay.
Delaying the response greatly reduces the efficiency of brute force
password attacks, limiting tries to one-per-second per connection.
Limiting the number of client connections allowed by lighttpd with
server.max-connections sets an upper bound on password tries per second,
but also makes it easier for an attacker to DoS (denial of service) the
server.  Therefore, while this mitigation is enabled by default, it can
be disabled with
  server.feature-flags += ("auth.delay-invalid-creds" => "disable")
1 year ago
Glenn Strauss fbade1850f [multiple] reset http vers, avoid rare crash (fixes #3152)
(thx ultimator)

do not set r->http_version to HTTP_VERSION_2 when selecting TLS ALPN
if r->handler_module already set, since handler module is likely
mod_sockproxy, and con->h2 will not get initialized.

This does continue to select "h2", so the mod_sockproxy backend
should be prepared to receive the HTTP/2 client connection preface.

x-ref:
  "Random Segfaults with version 1.4.64 w/ mod_sockproxy and ALPN h2"
  https://redmine.lighttpd.net/issues/3152
1 year ago
Glenn Strauss 1ed3a78ea9 [core] send Priority resp hdr w/ .css, .js re-prio
send Priority response header with .css, .js re-prioriziation
1 year ago
Glenn Strauss 59b9a9a73d [core] h2 prio sort urgency, incr, then stream id
h2 priority sort based on urgency, incremental, then stream id
1 year ago
Glenn Strauss d48947ffa0 [core] fix config typo reading large int from str 1 year ago
Glenn Strauss b1f7ccd750 [multiple] limit scope of socket config options
warn if socket config options used only at startup are used outside
global scope or $SERVER["socket"] with '==' condition
1 year ago
Glenn Strauss d0494fc081 [multiple] recognize HTTP QUERY method
x-ref:
  https://www.ietf.org/id/draft-ietf-httpbis-safe-method-w-body-02.html
1 year ago
Glenn Strauss 206fafa37d [core] quiet compiler warning 1 year ago
Glenn Strauss 20b6ef9985 [mod_webdav] opt for partial PUT via copy/rename
option for partial PUT via copy/modify/rename

webdav.opts += ("partial-put-copy-modify" => "enable")

Some modern filesystems support efficiently cloning files,
making it less expensive to copy to a tempfile, modify, and
atomically rename the modified tempfile to replace the original.
1 year ago
Glenn Strauss f3258cef1f [mod_mbedtls] use newer mbedtls 3.2.0+ interfaces 1 year ago
Glenn Strauss 3795c6740c [core] stricter check of HTTP/2 GOAWAY frame size 1 year ago
Glenn Strauss 0f3075b885 [core] send HTTP/2 SETTINGS_NO_RFC7540_PRIORITIES
send HTTP/2 SETTINGS_NO_RFC7540_PRIORITIES=1 with server connection
preface

RFC9218 Extensible Prioritization Scheme for HTTP
  2.1 Disabling RFC 7540 Priorities
  If endpoints use SETTINGS_NO_RFC7540_PRIORITIES they MUST send it in
  the first SETTINGS frame.

RFC7540 Hypertext Transfer Protocol Version 2 (HTTP/2)
  6.5.3.  Settings Synchronization
  Unsupported parameters MUST be ignored.

x-ref:
  https://datatracker.ietf.org/doc/html/rfc9218
  https://datatracker.ietf.org/doc/html/rfc7540
1 year ago
Glenn Strauss 9a3f6c521b [core] HTTP/2 PRIORITY_UPDATE frame (experimental)
*experimental* support for HTTP/2 PRIORITY_UPDATE frame

x-ref:
  "Extensible Prioritization Scheme for HTTP"
  https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-priority-12
  https://datatracker.ietf.org/doc/html/rfc9218
1 year ago
Glenn Strauss e5dc98faf3 [mod_sockproxy] reset http vers, avoid rare crash (fixes #3152)
(thx ultimator)

x-ref:
  "Random Segfaults with version 1.4.64 w/ mod_sockproxy and ALPN h2"
  https://redmine.lighttpd.net/issues/3152
1 year ago
Glenn Strauss 63beba3a4c [core] allow redirect,rewrite ext subst w/o pcre
allow redirect and rewrite extended substitution when lighttpd is built
without pcre.  When built without pcre, url.rewrite and url.redirect
always match first list entry as if it were "", and numerical
substitutions ($0 %0 $1 %1 etc) are always ignored, but other extended
substitutions (e.g. ${url.path}) may still occur.
1 year ago
Glenn Strauss 7258624e51 [tests] able to run tests when built w/o pcre
perl test framework now runs most tests even when lighttpd has been
built without pcre support, though some tests which rely on regex
are skipped (tests/core-condition.t)
1 year ago
Glenn Strauss dcb5f2318b [core] convert simple config cond regex to pre/sfx
convert simple config condition regex to prefix/suffix match
1 year ago
Glenn Strauss b3e80a1363 [core] tighten config parsing loop 1 year ago
Glenn Strauss 39c312780e [core] prefix (=^), suffix (=$) config conditions (fixes #3153)
x-ref:
  "lighttpd.conf conditionals using prefix and suffix matching"
  https://redmine.lighttpd.net/issues/3153
1 year ago
Glenn Strauss 8071b80388 [core] request_config bitmasks for smaller struct 1 year ago
Glenn Strauss efb24c54b9 [core] consolidate trace for log-state-handling
consolidate trace func for debug.log-state-handling = "enable"
1 year ago
Glenn Strauss 0012d7ef93 [core] reformat h2.h for cleaner enum additions
reformat h2.h for cleaner enum additions in the future
1 year ago
Glenn Strauss 8fa3014483 [core] short-circuit earlier parsing h2 trailers 1 year ago
Glenn Strauss aa4d9b63c3 [core] build fix for cygwin and lmingw 1 year ago
Glenn Strauss e298e868d6 [mod_extforward] support addtl IPv6 syntax w/ "[]"
support addtl IPv6 syntax w/ "[...]" in extforward.forwarder
when used with CIDR masks (n.b. only support "[]" with CIDR masks)
1 year ago
Glenn Strauss 1bb0cbc798 [build] -D_DEFAULT_SOURCE consistency in builds
(previously defined in src/CMakeLists.txt)
1 year ago
Glenn Strauss 772919f934 [core] stricter conformance w/ upcoming HTTP/2 rev
stricter conformance with upcoming HTTP and HTTP/2 RFC revisions
1 year ago
Glenn Strauss aea4a18098 [TLS] warn if leaf cert read is inactive/expired
When reading certificates, warn if leaf certificate is inactive/expired
(according to notBefore, notAfter fields of leaf certificate)
(note: not adding a delta for fudge factor when comparing times)
(note: not currently verifying each certificate in chain)
1 year ago