Commit Graph

2412 Commits (09b2b146e1ec44b2a7d1f407589e207bf2b176c4)

Author SHA1 Message Date
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
2017-09-23 10:30:08 -04:00
Glenn Strauss 17373221b8 [mod_wstunnel] fix config parsing bug
fix logic inversion when validating values in

(thx nicorac)

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]"disable" for stream
set default = "disable" for streaming when = 1 or 2 is set in the global scope

It is still recommended that embedded and other low-memory systems
explicitly set = "disable" in the global scope
(regardless of setting)

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

  "https POST requests buffered in RAM since v1.4.41?"
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 = 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

  ".mmap in chunk.c on AIX 5.2"
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)

  "Feature request: add server config for setting permissions on Unix domain socket"
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)

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 and
feature to take a filename, which was introduced in lighttpd 1.4.43

  "Custom HEADER and README filepaths in mod_dirlisting are treated as relative paths instead of absolute paths when file name starts with '/'"
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
Glenn Strauss 477534084a [mod_wstunnel] websocket tunnel to other protocol

decodes websockets and passes body back and forth from backend
(body could be known protocol such as JSON, or any custom protocol)

originally based off
2017-07-25 02:29:23 -04:00
Glenn Strauss 889db409dc [core] add public domain SHA1() if no crypto
add public domain SHA1() if not linking with crypto lib

obtained from
 * Originally written by Steve Reid <>
 * Modified by Aaron D. Gifford <>
 * The original unmodified version is available at:
2017-07-25 02:07:49 -04:00
Glenn Strauss fad841d69b [core] do not remove pid-file in test mode
do not remove pid-file in test mode (whether test passes or fails)

(thx m4t)
2017-07-25 01:49:18 -04:00
Glenn Strauss 42ab331dc9 [core] consistent behavior w/ and w/o SA_SIGINFO
and consistent open of
2017-07-23 19:02:31 -04:00
Glenn Strauss 7bda136e5f [mod_webdav] PROPFIND getetag attr must match GET
PROPFIND getetag attr must match Etag response header from GET request

For consistency, make similar change in mod_ssi.

(thx ethoms)

  "mod_webdav: Etag in response differs between PROPFIND and GET"
2017-07-23 19:02:31 -04:00
Glenn Strauss adeec956c3 [core] restart piped loggers if they exit (fixes #1393)
  "access log pipe writer should restart child process if it exits"
2017-07-23 19:02:31 -04:00
Glenn Strauss 167cdc846c [core] reap lighttpd worker pids precisely
do not start another lighttpd worker if some other child process exits
(e.g. piped logger or dynamic backend fastcgi, scgi, proxy)
2017-07-23 19:02:31 -04:00
Glenn Strauss ad7d6a6b15 [core] fdevent_cycle_logger()
fdevent_cycle_logger() re-opens log files before closing existing fd
2017-07-23 19:02:31 -04:00
Glenn Strauss d742e43834 [doc] update README
remove RCSid tags
authors are listed in AUTHORS file
amend list of supported platforms (still incomplete)

...more changes are needed to update contents to current feature set
2017-07-23 19:02:31 -04:00
Glenn Strauss b50aa2df51 quell compiler warnings for -Wimplicit-fallthrough 2017-07-23 19:02:31 -04:00
Glenn Strauss d66cbe9577 [core] adaptive spawning for socket backend procs (fixes #1162)

enable adaptive spawning for socket backend processes

new feature will allow "min-procs" => "0" and will spawn a backend
upon receipt of a request, if no backends are currently running.
This may be useful on resource-limited systems where there is a
seldom-used resource-intensive backend, such as home router
configuration web pages.  The first request may be slower as the
backend is starting up, but then subsequent requests within
"idle-timeout" will hit the (temporarily) persistent backend for
faster responses.

  "Adaptive spawning with min-procs=>0"
2017-07-23 19:02:30 -04:00
Glenn Strauss 1836309209 [core] resolve DNS at startup for socket backends
resolve DNS at startup and use the first IP address returned by resolver

Note: use of IP addresses is recommended instead of using DNS names.
If DNS names are used, but DNS is slow or unavailable, then lighttpd
will either appear to hang at startup or will fail to start up.
2017-07-23 19:02:30 -04:00
Glenn Strauss 0beb8b89d8 [core] store sockaddr for socket backend procs
store struct sockaddr for socket backend procs at startup
2017-07-23 19:02:30 -04:00
Glenn Strauss b6d0818762 [core] spread load on socket backend procs
connection attempts in progress count towards proc load so that bursts
of new connections do not all queue for current least busy proc

(makes a difference only for local backends with more than one proc)
2017-07-23 19:02:29 -04:00
Glenn Strauss 45b970e69b [core] shared code for socket backends
common codebase for socket backends, based off mod_fastcgi with
some features added for mod_proxy

(mostly intended to reduce code duplication and enhance code isolation)

mod_fastcgi and mod_scgi can now use fastcgi.balance and scgi.balance
  for similar behavior as proxy.balance, but the balancing is per-host
  and not per-proc.  proxy.balance is also per-host and not per-proc.

mod_proxy and mod_scgi can now use and, similar to

mod_fastcgi behavior change (affects only mod_status):
- statistics tags have been renamed from "fastcgi.*" to "gw.*"
  "fastcgi.backend.*"       -> "gw.backend.*"
  "" -> ""
  ("fastcgi.requests" remains "fastcgi.requests")
  ("proxy.requests" is new)
  ("scgi.requests" is new)

mod_scgi behavior change (likely minor):
- removed scgi_proclist_sort_down() and scgi_proclist_sort_up().
  procs now chosen based on load as measured by num socket connnections

modules using gw_backend.[ch] are currently still independent modules.
If it had been written as a single module with fastcgi, scgi, proxy
implementations, then there would have been a chance of breaking some
existing user configurations where module ordering made a difference
for which module handled a given request, though for most people, this
would have made no difference.

Details about mod_fastcgi code transformations:
unsigned int debug -> int debug
fastcgi_env member removed from plugin_config
renamed "fcgi" and "fastcgi" to "gw", and "FCGI" to "GW"
reorganize routines for high-level and lower-level interfaces
some lower-level internal interfaces changed to use host,proc,debug
  args rather than knowing about higher-level (app) hctx and plugin_data
tabs->spaces and reformatting
2017-07-23 19:02:00 -04:00
Glenn Strauss 81b8fffd31 [mod_fastcgi,mod_scgi] use temp buffer for cgi_env 2017-07-15 22:42:15 -04:00
Glenn Strauss 6e1c02f386 [mod_fastcgi,mod_scgi] parse bin_path at startup 2017-07-15 22:42:15 -04:00
Glenn Strauss 35c4bf5857 [mod_fastcgi,mod_scgi] struct member consistency 2017-07-15 22:42:15 -04:00
Glenn Strauss 3ae7fb1bdd [mod_scgi] remove unused parse_response member 2017-07-15 22:42:15 -04:00
Glenn Strauss c0a9020935 [mod_fastcgi,mod_scgi] consistent connect() error
more consistent connect() error handling

NOTE: behavior change in mod_scgi:
  "disable-time" default is now 1 second (was 60 seconds)
  The new behavior matches the default in mod_fastcgi
  (and is a much saner default disable time).
2017-07-15 22:42:15 -04:00
Glenn Strauss d836c72751 [mod_fastcgi] move delayed connect() into switch()
move delayed connect() handling into switch()
2017-07-15 22:42:15 -04:00