Commit Graph

2974 Commits

Author SHA1 Message Date
Glenn Strauss 78f24ba141 [core] silence coverity warning 2019-03-07 00:32:17 -05:00
Glenn Strauss b9e2be50c9 [mod_auth] HTTP Auth Digest algorithm=SHA-256
(also support Digest algorithm=SHA-512-256 if library support present)

enable additional algorithms by configuring lighttpd.conf auth.require
with new optional keyword "algorithm" => "MD5|SHA-256"

default algorithm remains MD5 if "algorithm" not specified

Tested with: curl --digest -u "user:pass" ... (which supports SHA-256)

x-ref:
  "HTTP Digest Access Authentication"
  https://tools.ietf.org/html/rfc7616
2019-03-07 00:32:17 -05:00
Glenn Strauss 1fb0d7e295 [core] no SOCK_NONBLOCK on QNX 7.0
QNX 7.0 has SOCK_CLOEXEC but not SOCK_NONBLOCK

(thx supergaute)

github: closes #98

x-ref:
  "Fix compile error when system has SOCK_CLOEXEC but not SOCK_NONBLOCK"
  https://github.com/lighttpd/lighttpd1.4/pull/98
2019-03-07 00:32:17 -05:00
Glenn Strauss 28895ab297 [mod_auth] pass http_auth_require_t for 401 Unauth
pass (http_auth_require_t *) to mod_auth_send_401_unauthorized_digest()
for configured digest algorithms for 401 Unauthorized
2019-03-07 00:32:17 -05:00
Glenn Strauss 60f4cf3ad8 [mod_auth] http_auth_info_t digest abstraction 2019-03-07 00:32:17 -05:00
Glenn Strauss 07fef25867 [mod_auth] http_auth_digest_hex2bin()
replace http_auth_md5_hex2bin() with more generic function to handle
digests of different lengths
2019-03-07 00:32:17 -05:00
Glenn Strauss 9113011d5b [core] pass (fdnode *) for registered fdevent fd
inline fdevent_fdnode_interest()
avoid array lookup for (fdnode *) for various ops
2019-03-07 00:32:17 -05:00
Glenn Strauss 0e108390e5 [core] modify config parser to handle multiple }
modify config parser to handle multiple '}' on same line
2019-03-07 00:32:17 -05:00
Glenn Strauss d76756ca10 [core] perf: pass (fdnode *) to epoll and kqueue 2019-03-07 00:32:17 -05:00
Glenn Strauss c83fff1dda [core] release empty chunk buf when nothing read 2019-03-07 00:32:17 -05:00
Glenn Strauss 41384a3657 [core] isolate fdevent processing 2019-03-07 00:32:17 -05:00
Glenn Strauss 1a99aad1c0 [core] pull server load checks out of main loop 2019-03-07 00:32:17 -05:00
Glenn Strauss 99f8ae0d0d [mod_openssl] use 16k static buffer instead of 64k
better match size used by openssl
(avoid unused, oversized reads)
2019-03-07 00:32:17 -05:00
Glenn Strauss 4e6e787a0d [core] remove redundant check for allow_http11
(conf.allow_http11 is handled in http_response_prepare())
2019-03-07 00:32:17 -05:00
Glenn Strauss 800e9b7349 [core] remove fde_ndx member outside fdevents
(isolated to fdevent framework internals)
2019-03-07 00:32:17 -05:00
Glenn Strauss 0a46f7ec23 [core] some fdevent code streamlining
isolate fde_ndx to fdevent framework internals
2019-03-07 00:32:17 -05:00
Glenn Strauss 8441c9e8e8 [core] config option to allow GET w/ request body
server.http-parseopts = ( "method-get-body" = "enable" )
2019-03-07 00:32:17 -05:00
Glenn Strauss 8167497899 [mod_proxy] pass Content-Length to backend if > 0
pass Content-Length to backend if > 0, even if GET or HEAD method
(and pass Content-Length: 0 for other methods if no request body)
2019-03-07 00:32:17 -05:00
Glenn Strauss 8efa6a34f4 [mod_openssl] default: ssl.cipher-list = "HIGH" 2019-03-07 00:32:17 -05:00
Glenn Strauss 3e200717cc [mod_openssl] inherit cipherlist from global scope
inherit cipherlist from global scope if not set in $SERVER["socket"]
2019-03-07 00:32:17 -05:00
Glenn Strauss 1542e44bb7 [core] use openssl to read,discard request body
use openssl to read,discard request body after response has been sent
on a TLS connection, at least until SSL close notify has been sent

x-ref:
  "HTTPS POST upload hangs when i reach maximum supported request size"
  https://redmine.lighttpd.net/boards/2/topics/8491
2019-03-07 00:32:14 -05:00
Glenn Strauss fca9e5a0b1 [core] prefer memchr() over strchr() 2019-02-17 19:51:12 -05:00
Glenn Strauss fc914ae442 [core] map FDEVENT_* to OS system event frameworks
(avoid need to translate event flags between OS and lighttpd FDEVENT_*)
2019-02-17 18:35:05 -05:00
Stefan Bühler 9232145024 [core] poll: fdarray uses fd as index, not fde_ndx 2019-02-16 11:26:50 +01:00
Stefan Bühler 1bd1d559b5 [core] don't call fd event handlers more than once, they might already be gone (fixes segfault) 2019-02-16 10:52:49 +01:00
Glenn Strauss f5f221eda8 [core] dispatch events from within event framework
event framework now calls interface to dispatch events rather than
itself implementing multiple interfaces for fdevent_process() to
be able to dispatch events generically.
2019-02-13 21:34:59 -05:00
Glenn Strauss 9459c05468 [core] fix mixed use of srv->split_vals array (fixes #2932)
regression in mod_evhost in lighttpd 1.4.53
regression in mod_flv_streaming in lighttpd 1.4.51 - lighttpd 1.4.53

(thx moisseev)

x-ref:
  "[regression] %0 pattern does not match hostnames without the domain part"
  https://redmine.lighttpd.net/issues/2932
2019-02-13 19:54:22 -05:00
Glenn Strauss 13f957d283 [core] simpler loops to run plugin hooks 2019-02-13 02:07:53 -05:00
Glenn Strauss c38eddfc29 [core] skip plugins_call_cleanup if not init'ed 2019-02-13 00:42:23 -05:00
Glenn Strauss b1a9f335c6 [core] connection_handle_write() updates con state
(return value was always 0, so remove checks for other values)
2019-02-12 23:00:26 -05:00
Glenn Strauss 4713b6a61c [core] con->is_ssl_sock
flag to indicate if socket protocol is TLS
(future use: will be needed with connection upgrade to https; not impl)
2019-02-12 22:51:17 -05:00
Glenn Strauss d28bac32fe [multiple] reduce code dup in list resizing
reduce code duplication in list resizing
realloc() of NULL ptr has behavior similar to malloc()

Note that if initial size == 0, then code used to adjust size
must be += x to ensure the size is non-zero for reallocation.
(Multiplying 0 * x, e.g. power-2 resizing, will result in 0.)
2019-02-12 22:36:04 -05:00
Glenn Strauss 31b546e367 [core] fix gw_backend spelling of directive in err
fix gw_backend spelling of bin-path directive in error message
2019-02-11 11:53:07 -05:00
Glenn Strauss 74b18c385c [core] no keep-alive if POLLRDHUP,empty read queue
send Connection: close if POLLRDHUP received and read queue is empty
2019-02-10 22:15:59 -05:00
Glenn Strauss 9948537721 [core] discard oversized trailers
x-ref:
  "PVS-Studio Analysis Results"
  https://redmine.lighttpd.net/boards/3/topics/8459
  http://www.fly-server.ru/pvs-studio/lighttpd/
2019-02-10 20:47:19 -05:00
Glenn Strauss b2c18f480d [mod_auth] minor: adjust config validation
x-ref:
  "PVS-Studio Analysis Results"
  https://redmine.lighttpd.net/boards/3/topics/8459
  http://www.fly-server.ru/pvs-studio/lighttpd/
2019-02-10 20:47:19 -05:00
Glenn Strauss 25bb4406fa [mod_deflate] honor request for x-gzip, x-bzip2
honor request for x-gzip, x-bzip2 if gzip, bzip2 not requested

x-ref:
  "PVS-Studio Analysis Results"
  https://redmine.lighttpd.net/boards/3/topics/8459
  http://www.fly-server.ru/pvs-studio/lighttpd/
2019-02-10 20:47:19 -05:00
Glenn Strauss 859c9ae586 [multiple] minor: remove duplicated conditions
x-ref:
  "PVS-Studio Analysis Results"
  https://redmine.lighttpd.net/boards/3/topics/8459
  http://www.fly-server.ru/pvs-studio/lighttpd/
2019-02-10 20:26:58 -05:00
Glenn Strauss daa5f7c576 [mod_accesslog] attempt to reconstruct req line
cease http_request_parse_reqline() unconditionally copying request line,
as request line is currently used only by mod_accesslog 'r' format
2019-02-10 03:10:11 -05:00
Glenn Strauss 950832af67 [core] RFC7230 HTTP-version parse 2019-02-10 02:57:09 -05:00
Glenn Strauss 9149b56418 [core] get_http_method_key() match by strlen first 2019-02-09 16:16:20 -05:00
Glenn Strauss b9a37291cb [core] lift code out of request line parse loop 2019-02-09 15:48:05 -05:00
Glenn Strauss e5d61e9a5f [core] http_request_parse() mark error paths cold 2019-02-09 14:30:00 -05:00
Glenn Strauss e0a35b75c0 [core] mark log_error_write*() funcs cold 2019-02-09 00:06:10 -05:00
Glenn Strauss 23b0d867c5 [core] replace con->response.keep_alive
set con->keep_alive = 0 to indicate backend request to close connection
2019-02-08 23:18:36 -05:00
Glenn Strauss 25185d1de0 [core] pass req hdrs buffer to http_request_parse 2019-02-08 22:49:46 -05:00
Glenn Strauss 7493d628b9 [core] prefer buffer_caseless_compare()
prefer buffer_caseless_compare() to strcasecmp()
2019-02-08 22:49:46 -05:00
Glenn Strauss 7f8fd8ad09 [core] make parse_request,request.request same buf 2019-02-08 22:49:46 -05:00
Glenn Strauss d7ad5819e6 [core] copy request only if might need for logging
copy request header only if we may need to log it upon error
2019-02-08 22:49:46 -05:00
Glenn Strauss a620f80b77 [core] log_request_header_on_error in one place 2019-02-08 22:49:46 -05:00