Commit Graph

2433 Commits (7bd46d198407faa7e04a2b883309da7ef1c7d7a9)

Author SHA1 Message Date
Glenn Strauss 7bd46d1984 [core] fix $REQUEST_HEADER[...] parsing in config (#1556)
x-ref:
  "Allow matching against any arbitrary HTTP header in the configuration file regexps"
  https://redmine.lighttpd.net/issues/1556
  https://redmine.lighttpd.net/boards/2/topics/7609
2017-10-14 13:51:49 -04:00
Glenn Strauss 8ed588ce32 [core] handle fds pending close after poll timeout (fixes #2827)
handle fds pending close whether or not new events are triggered

(thx davidm)

x-ref:
  "POST to mod_cgi sometimes hangs"
  https://redmine.lighttpd.net/issues/2827
2017-10-12 02:44:35 -04:00
Glenn Strauss 60a98ebaf4 [core] quiet coverity warning 2017-10-09 08:50:26 -04:00
Glenn Strauss 513e407b06 [mod_wstunnel] remove invalid appended '\0'
remove invalid appended '\0' in code originating from Norio Kobota
mod_websocket_frame.c.  /* needs '\0' char to send */ is not valid

x-ref:
  "wstunnel sample config"
  https://redmine.lighttpd.net/boards/2/topics/7600
2017-10-09 02:45:12 -04:00
Glenn Strauss ef11fa42da [mod_wstunnel] set Sec-WebSocket-Protocol if bin
set Sec-WebSocket-Protocol: binary in response if request header
Sec-WebSocket-Protocol: binary provided by client in Upgrade: websocket
request, or if wstunnel.frame-type = "binary" in lighttpd config
2017-10-09 02:45:12 -04:00
Glenn Strauss d8dba4ae6a [core] gateways might Upgrade con before body read
some gateways might Upgrade connection before request body is read

(mod_wstunnel sets con->file_started = 1 and -1 == hctx->wb_reqlen
 and sends Connection: upgrade and Upgrade: websocket before reading
 request body)

x-ref:
  "wstunnel sample config"
  https://redmine.lighttpd.net/boards/2/topics/7600
2017-10-09 02:45:12 -04:00
Glenn Strauss b8e6419f3a [core] return from http_response_read if small rd
return from http_response_read() if read smaller than available buffer
2017-10-09 02:45:12 -04:00
Glenn Strauss 0528e2e712 [core] limit use of TCP_CORK
limit use of TCP_CORK to when chunkqueue contains a non-MEM_CHUNK
(in addition to restricting to Linux, more than one chunk, and TCP)
2017-10-09 02:45:12 -04:00
Glenn Strauss f22b5d69da [core] inline chunkqueue_is_empty() 2017-10-09 02:45:12 -04:00
Glenn Strauss 9a69f31b20 [core] compare listen addrs after DNS resolution
compare listen addrs after DNS resolution when starting up server
2017-10-09 02:45:12 -04:00
Glenn Strauss 5c25f629ab [core] /dev/stdin listener for inetd wait yes
server.bind = "/dev/stdin" for use with inetd wait yes

(experimental)

x-ref:
  "inetd/wait mode with auto-shutdown after idle timeout"
  https://redmine.lighttpd.net/issues/2824
2017-10-09 02:44:30 -04:00
Glenn Strauss 00d976b130 [core] cleaner code; remove goto from network.c 2017-10-07 16:11:36 -04:00
Glenn Strauss 878dd9be49 [core] use sun_path for addr string for AF_UNIX (fixes #2826)
(occurs when lighttpd is configured to listen on unix socket path)

x-ref:
  "stale REMOTE_ADDR when using AF_UNIX socket"
  https://redmine.lighttpd.net/issues/2826
2017-10-07 13:16:52 -04:00
Glenn Strauss 7aff5046ac [unittests] consolidate base64 test code
consolidate base64 test code

use char type for tables to reduce memory use
  (potentially increase cache hits)
2017-10-03 22:21:53 -04:00
Glenn Strauss c49f515096 [network] do not append port to unix socket paths
x-ref:
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=877039
2017-10-03 21:16:03 -04:00
Glenn Strauss 513887fa52 [core] URI scheme is case-insensitive
check case-insensitive scheme if full URI provided in request-line

RFC7230:
  The scheme and host are case-insensitive and normally provided
  in lowercase; all other components are compared in a case-sensitive
  manner.

x-ref:
  "https://redmine.lighttpd.net/boards/3/topics/7637"
2017-10-03 21:16:03 -04:00
Stefan Bühler 428cd963d6 [lemon] fix gcc implicit-fallthrough warning 2017-10-03 21:16:03 -04:00
Stefan Bühler f46b1b1d53 [algo_sha1] fix compile break and warnings
size_t requires <sys/types.h> or <unistd.h>, <stdint.h>/<inttypes.h> is
not enough.

also use `const` consistently for the passed data.
2017-10-02 01:52:43 -04:00
Glenn Strauss 46719b8925 [mod_wstunnel] fix NULL ptr deref
fix NULL ptr deref if wstunnel.server configured inside a conditional
and not in global scope

(thx nicorac)

x-ref:
  "https://redmine.lighttpd.net/boards/2/topics/7600"
2017-09-30 00:11:59 -04:00
Glenn Strauss a156fdbc7b [core] fix triggered assert on HTTP chunked input (fixes #2822)
(thx AlxT)

x-ref:
  "Segmentation fault on HTTP chunked input"
  https://redmine.lighttpd.net/issues/2822
2017-09-27 23:01:03 -04:00
Glenn Strauss cbb5ee621c [core] disable Nagle if streaming to backend
disable Nagle algorithm if streaming to backend and content-length
is unknown at the point where lighttpd is about to begin sending
data to backend
2017-09-23 13:11:26 -04:00
Glenn Strauss 09b2b146e1 [core] make strftime_cache_get() 16-element cache
Prior code was effectively a 1-element cache after the initial fill
of the array since only the first element was replaced after the
initial fill.  New code does round-robin replacement.

(whether or not #define FILE_CACHE_MAX 16 is appropriately sized here
 is a question for another day)
2017-09-23 12:05:13 -04:00
Glenn Strauss 93e91954a7 [core] fdevent setsockopt() helper functions
fdevent_set_tcp_nodelay()
fdevent_set_so_reuseaddr()
2017-09-23 10:30:08 -04:00
Glenn Strauss 17373221b8 [mod_wstunnel] fix config parsing bug
fix logic inversion when validating values in wstunnel.origins

(thx nicorac)

x-ref:
  "https://redmine.lighttpd.net/boards/2/topics/7600"
2017-09-21 01:03:14 -04:00
Glenn Strauss 6e171bd4b9 [core] adjust li_rand_pseudo* interfaces 2017-09-20 22:48:35 -04:00
Glenn Strauss 2bed2c14af [mod_webdav] check HAVE_UUID for -luuid
check HAVE_UUID for -luuid in order to detect more pedantic cases,
e.g. when -luuid is not installed under Cygwin, even if devel headers
are present (<uuid/uuid.h>)
2017-09-10 22:12:24 -04:00
Glenn Strauss cf4bc764dc [mod_cgi] omit cgi_handle_fdevent after proc exit
Omit calling cgi_handle_fdevent() after CGI process exit.
Another (sub)process may be holding pipe fd open and might write
response instead of the initial CGI process.
2017-09-10 22:10:12 -04:00
Glenn Strauss e951152e2b [mod_cgi] add FDEVENT_IN upon CGI exit
add FDEVENT_IN in addition to FDEVENT_HUP when triggering
cgi_handle_fdevent() after the CGI process exits.

(This helps improve reliability when running tests under Cygwin)
2017-09-10 22:08:04 -04:00
Glenn Strauss f4e1357df5 [mod_openssl] ssl.read-ahead="disable" for stream
set default ssl.read-ahead = "disable" for streaming when
server.stream-request-body = 1 or 2 is set in the global scope

It is still recommended that embedded and other low-memory systems
explicitly set ssl.read-ahead = "disable" in the global scope
(regardless of server.stream-request-body setting)

On the other hand, for systems which enable server.stream-request-body
to non-zero value, and for which sufficient memory is available, then
ssl.read-ahead = "enable" is recommended and should be explicitly set
in the global or $SERVER["socket"] configuration blocks in lighttpd.conf

x-ref:
  "https POST requests buffered in RAM since v1.4.41?"
  https://redmine.lighttpd.net/boards/2/topics/7520
2017-09-10 18:52:41 -04:00
Glenn Strauss 3622d2b66a [mod_rrdtool] handle_trigger returns HANDLER_GO_ON
handle_trigger should return HANDLER_GO_ON even on error,
since we want other trigger funcs from other modules to
be able to perform periodic maintenance
2017-09-10 16:29:08 -04:00
Glenn Strauss 9030cfaecf [core] SIGCHLD handle_waitpid hook for modules
centralize most waitpid() handling in core server, with hooks for
modules to be informed of pid and status when a process exits.

This enables faster discovery (and restart) of exited processes,
and also allows for lighttpd to manage backend processes in the
parent (master) process when server.max-worker > 0.
2017-09-10 16:24:34 -04:00
Glenn Strauss 26dce93086 [core] attempt to quiet compiler warning in LEDE 2017-09-10 15:27:28 -04:00
Glenn Strauss dadfb5fcf5 [core] attempt to quiet coverity false positives 2017-08-12 21:43:04 -04:00
Glenn Strauss 9bc61f16cb [core] attempt to quiet coverity false positives 2017-08-12 15:39:12 -04:00
Glenn Strauss 748fc860fb [mod_fastcgi] fix return when streaming min buffer
fix incorrect return value when server.stream-response-body = 2
2017-08-12 12:59:58 -04:00
Glenn Strauss 85325d9c19 [mod_cgi] fix bug to properly exec interpreter
fix bug to properly exec interpreter when cgi handler is set

(thx stbuehler)
2017-08-12 03:11:20 -04:00
Glenn Strauss 8228273473 [mod_accesslog] flush access logs every 4 seconds 2017-08-10 06:46:49 -04:00
Glenn Strauss ca7a97f211 [core] workaround for AIX mmap define
AIX might #define mmap mmap64 and this conflicts with .mmap member
of struct chunk in chunk.h

x-ref:
  ".mmap in chunk.c on AIX 5.2"
  https://redmine.lighttpd.net/boards/2/topics/7512?r=7513
2017-08-08 22:51:32 -04:00
Glenn Strauss b6bd4d3d94 [mod_extforward] PROXY proto and SSL_CLIENT_VERIFY
Use config directive extforward.hap-PROXY-ssl-client-verify = "enable"
to enable setting SSL_CLIENT_VERIFY, REMOTE_USER, and AUTH_TYPE using
information provided by HAProxy PROXY protocol.
2017-08-06 23:32:33 -04:00
Glenn Strauss 7ec74fe7b1 [core] warn if backend server config contains '_'
(detect a common config typo)
2017-08-06 23:32:25 -04:00
Glenn Strauss 19d2190a4f [core] set socket perms after bind, before listen
(it is still recommended to create sockets in protected directories)

x-ref:
  "Feature request: add server config for setting permissions on Unix domain socket"
  https://redmine.lighttpd.net/issues/656
2017-08-03 00:37:43 -04:00
Glenn Strauss 3c8afd194c [core] base_decls.h to quiet compiler warnings
quiet compiler warning for -Wtypedef-redefinition
(redefinition of typedef is a C11 feature)
2017-07-30 23:45:01 -04:00
Glenn Strauss 2e0f87c8a5 [core] add missing #include
(quiet compiler warning)
2017-07-30 23:28:07 -04:00
Glenn Strauss 6def094c23 [core] fix invalid sizeof() identified by coverity
and quiet other coverity warnings
2017-07-30 23:28:07 -04:00
Glenn Strauss c5865d4f0b [mod_cgi] add missing #include 2017-07-30 22:28:13 -04:00
Glenn Strauss cdfddce707 [mod_extforward] typo in comment 2017-07-30 12:24:01 -04:00
Glenn Strauss d4a37a3bbb [core] remove fdevent fcntl_set hook
(could have been removed in 2010 with commit 38f2d1dd
 which removed fdevent_linux_rtsig.c)
2017-07-29 00:36:48 -04:00
Glenn Strauss c23f8fdd6f [core] set one-shot mode fd O_NONBLOCK, FD_CLOEXEC
(thx citaylor)

x-ref:
  https://redmine.lighttpd.net/boards/2/topics/7487
2017-07-29 00:36:35 -04:00
Glenn Strauss 07e57e24c2 [mod_dirlisting] treat README and HEADER as paths (fixes #2818)
Treat README and HEADER as filepaths.  If absolute path, take as-is.
If relative path, then take relative to directory physical path.

This extends dir-listing.show-header and dir-listing.show-readme
feature to take a filename, which was introduced in lighttpd 1.4.43

x-ref:
  "Custom HEADER and README filepaths in mod_dirlisting are treated as relative paths instead of absolute paths when file name starts with '/'"
  https://redmine.lighttpd.net/issue/2818
2017-07-28 00:11:28 -04:00
Glenn Strauss 6e668bfe5f [core] forward SIGHUP only to lighttpd workers
(do not propagate SIGHUP to entire lighttpd process group,
 which might include other processes such as CGI, rrdtool,
 piped loggers, ...)
2017-07-27 23:09:12 -04:00