Commit Graph

2171 Commits (a09d80dfd18258f0e56dbd67323024628bf01a9e)
 

Author SHA1 Message Date
Stefan Bühler a09d80dfd1 fix SCons fullstatic build with glibc pthreads
[with some modifications by gstrauss]
7 years ago
Glenn Strauss c718064911 [mod_cgi] fall back to pipe() if pipe2() fails
This change should fix an issue with lighttpd on Debian kfreebsd-* arch
  (kfreebsd-amd64 and kfreebsd-i386)
.libs/mod_cgi.o: In function `cgi_create_env':
./src/mod_cgi.c:1103: warning: pipe2 is not implemented and will always fail

lighttpd is single-threaded so there is no race with pipe()
and then fcntl() F_SETFD FD_CLOEXEC on the pair of pipe fds.
Using pipe2() where available is still slightly more efficient
by eliding the syscalls to set FD_CLOEXEC.
7 years ago
Glenn Strauss 2ca402c64d [mod_proxy] proxy.replace-http-host enable/disable
mark directive as taking boolean value, not integer value
7 years ago
Glenn Strauss 15bc2313a4 [tests] mark tests/docroot/www/*.pl scripts a+x 7 years ago
Glenn Strauss 0f4cc0d697 [mod_evhost] fix an incorrect error trace 7 years ago
Glenn Strauss 22ca2778a8 [build] check for pipe2() at configure time
Lack of pipe2() on relic Unix as well as missing on Mac OSX is likely
one reason why threaded web servers such as nginx choose not to support
CGI except via an external service to the process.  Without pipe2(),
race conditions exist and it is not safe for a threaded server to use
pipe() and fork() when the server also does not want to potentially leak
open file descriptors to various unrelated CGI scripts.
7 years ago
Glenn Strauss 9619d643ff [build] compile fixes for AIX
x-ref:
  https://www.lighttpd.net/2016/10/31/1.4.43/  (see comments section)
7 years ago
Glenn Strauss 17f6595e1a [mod_secdownload] warn if SHA used w/o SSL crypto
issue warning at startup, instead of fatal error, if SHA used in
secdownload.algorithm = "..." but mod_secdownload was built without
SSL crypto.  When lighttpd is built without openssl, this allows most
tests/* to be run and pass, except the ones in tests/mod-secdownload.t
which use "hmac-sha1" or "hmac-sha256".

(alternatively, could have made, used isolated tests/secdownload.conf)
7 years ago
Glenn Strauss 6598968796 [mod_proxy] proxy.balance = "sticky" option (fixes #2117)
attempt to route requests to same backends based on requestor (client)
IP address and target host and port of request.

(thx bra)

x-ref:
  "Source IP sticky load balancing patch"
  https://redmine.lighttpd.net/issues/2117
7 years ago
Glenn Strauss 539deb7370 [autobuild] set NO_RDYNAMIC=yes for midipix
(thx Redfoxmoon)
7 years ago
Glenn Strauss 4d7f5737f1 [core] support Transfer-Encoding: chunked req body (fixes #2156)
support Transfer-Encoding: chunked request body in conjunction with
  server.stream-request-body = 0

dynamic handlers will still return 411 Length Required if
  server.stream-request-body = 1 or 2 (!= 0)
  since CGI-like env requires CONTENT_LENGTH be set
  (and mod_proxy currently sends HTTP/1.0 requests to backends,
   and Content-Length recommended for robust interaction with backend)

x-ref:
  "request: support Chunked Transfer Coding for HTTP PUT"
  https://redmine.lighttpd.net/issues/2156
7 years ago
Glenn Strauss f792d84cf9 [core] fix segfault when parsing a bad config file
(thx goblin)

x-ref:
  "fix a segfault when parsing a bad config file"
  https://github.com/lighttpd/lighttpd1.4/pull/75

github: closes #75
7 years ago
Glenn Strauss ede9b3fc4c [core] consolidate duplicated read-to-close code
more efficiently detect end-of-stream when closing connection

log fd prior to resetting fd to -1 when log_state_handling enabled
7 years ago
Glenn Strauss c367b1ca80 [mod_ssi] implement, ignore <!--#comment ... --> 7 years ago
Glenn Strauss 185e262bf5 [mod_ssi] basic recursive SSI include virtual (fixes #536)
EXPERIMENTAL: basic recursive SSI <!--#include virtual="..." -->
Marked experimental since behavior may change in future.

Prior behavior was simpler and treated them all as files included as-is.

New behavior treats all #include virtual="..." targets as SSI files.

In the future, this may change to be a full recursive subrequest and the
virtual path may be treated as a new subrequest and might be something
other than SSI (e.g. might be CGI).  This has not been implemented.

Current behavior processes <!--#include virtual="..." --> as static file
Enable new behavior by setting ssi.recursion-max to value other than 0.
ssi.recursion-max = X to set maximum recusion depth

x-ref:
  "add recursion to the SSI #include directive"
  https://redmine.lighttpd.net/issues/536
7 years ago
Glenn Strauss 879ce0b534 [mod_proxy] replace HTTP Host sent to backend (fixes #2770)
replace HTTP Host sent to backend if configured with
  proxy.replace-http-host = "enable"
and lighttpd.conf proxy.server definition provides replacement Host

(thx altblue)

x-ref:
  "Override proxified Host header"
  https://redmine.lighttpd.net/issues/2770
7 years ago
Glenn Strauss 090985af6b [mod_dirlisting] render dirlisting as HTML (fixes #2767)
(thx altblue)

x-ref:
  "Render dirlisting as HTML"
  https://redmine.lighttpd.net/issues/2767
7 years ago
Glenn Strauss da86a596f5 [core] permit connection-level state in modules
modules may now keep state for the lifetime of a connection,
rather than being required to be reset after every request (when
there can be multiple keep-alive requests on the same connection)
7 years ago
Glenn Strauss 28c8fec42b [core] defer li_rand_init() until first use
defer li_rand_init() until first use of li_rand_pseudo_bytes()

li_rand_init() is now deferred until first use so that installations
that do not use modules which use these routines do need to potentially
block at startup.  Current use by core lighttpd modules is in mod_auth
HTTP Digest auth and in mod_usertrack.  Deferring collection of random
data until first use may allow sufficient entropy to be collected by
kernel before first use, helping reduce or avoid situations in
low-entropy-generating embedded devices which might otherwise block
lighttpd for minutes at device startup.  Further discussion in
https://redmine.lighttpd.net/boards/2/topics/6981
7 years ago
Glenn Strauss 544ccee5e1 [core] remove srv->entropy[]
unlikely to provide any real additional benefit as long as
PRNG has been appropriately initialized with random data
7 years ago
Glenn Strauss 83ec97a054 [mod_ssi] produce content in subrequest hook
(prerequisite for future mod_ssi enhancements)

This commit also addresses the concern that mod_geoip would
(previously) need to be listed in modules prior to mod_ssi.
x-ref:
  https://github.com/lighttpd/lighttpd1.4/pull/73
7 years ago
Glenn Strauss ac9822f468 [core] combine duplicated connection reset code
connection_reset() now calls connection_response_reset()
instead of duplicating the code in both routines
7 years ago
Glenn Strauss 445bc2914a [mod_cml] include lua headers before base.h
to avoid (historical) conflict with IN and OUT macros used in lua
and openssl headers (since base.h includes openssl headers when present)
7 years ago
Glenn Strauss 431bc346df remove #include "stream.h" where not used 7 years ago
Glenn Strauss c64c2173ce [core] rename li_rand() to li_rand_pseudo_bytes()
to be more explicit that the result is pseudo-random data
and not cryptographically random.
7 years ago
Glenn Strauss 7ef58b5a81 [mod_authn_gssapi] fix missing error ret, coverity
fix missing error returns and coverity warnings
7 years ago
Glenn Strauss 1584c5d7d2 [doc] remove reference to Linux rt-signals
Linux rt-signals fdevent mechanism was removed a while ago
7 years ago
sugilog 331ac4f177 set systemd settings similar to lighttpd2
except that HUP does not reload lighttpd 1.4.x config
Those who only use systemd lighttpd service 'reload' to rotate
access log files might choose to add a command to send lighttpd a
HUP signal.  See github pull request (below) for further discussion.

[patch edited by gstrauss]

x-ref:
  https://github.com/lighttpd/lighttpd1.4/pull/72
7 years ago
fbrosson 4481489078 suggest inclusion of mod_geoip... before mod_ssi.
* In modules.conf, mod_geoip needs to be loaded before mod_ssi,
  otherwise GeoIP vars won't be available to SSI pages.
* In geoip.conf suggest GeoLiteCity.dat instead of GeoCityLite.dat.

github: closes #73
7 years ago
Glenn Strauss 394278c61a [build] build network_*.c into lighttpd executable
(not into liblightcomp used by modules, on platforms that require that)
7 years ago
Glenn Strauss 875a21c952 [mod_cgi] remove direct calls to network_backend* 7 years ago
Glenn Strauss 88b1f3994f openssl 1.1.0 init and cleanup 7 years ago
Glenn Strauss 64a7b64c2b RAND_pseudo_bytes() is deprecated in openssl 1.1.0 7 years ago
Glenn Strauss f9737e50a6 [mod_fastcgi,mod_scgi] warn if invalid "bin-path"
e.g. if /usr/bin/php-cgi does not exist

A distribution package might need to be installed:
'php-cli' Fedora package; 'php7.0-cgi' or 'php5-cgi' Debian package
7 years ago
Glenn Strauss 7d339e21db comment out auth.backend.ldap.* in tests/*.conf
(mod_authn_ldap is not loaded in these test confs,
 so mod_authn_ldap directives are not available)
7 years ago
Glenn Strauss f664e77909 load mod_auth & mod_authn_file in sample/test.conf 7 years ago
Glenn Strauss d5f64cd85f [mod_webdav] compile fix when locking not enabled 7 years ago
Glenn Strauss 4d95a8e300 [mod_authn_mysql] close mysql_conn in cleanup
close cached mysql_conn in server cleanup when server shuts down
7 years ago
Glenn Strauss 5bf5e1adcc fix race in dynamic handler configs (reentrancy) (fixes #2774)
(thx tobbe303)

x-ref:
  "CGI request not handled"
  https://redmine.lighttpd.net/issues/2774
7 years ago
Glenn Strauss df61f19daf [core] compile fix for Mac OS X 10.6 (old) (fixes #2773)
Mac OS X 10.7 Lion introduces arc4random_buf()

(thx ryandesign)

x-ref:
  "Mac OS X build issue Undefined symbols"
  https://redmine.lighttpd.net/issues/2773
7 years ago
Glenn Strauss e628fc3509 [mod_authn_gssapi] better resource cleanup 7 years ago
Glenn Strauss f635ae7a07 [mod_auth] compile fix for Mac OS X XCode (fixes #2772)
memcpy() may be a macro and gave error for missing arguement when
CONST_STR_LEN() macro is used (which expands to two arguments)

(thx ryandesign)

x-ref:
  "mod_authn_file.c:683:56: error: too few arguments provided to function-like macro invocation (memcpy)"
  https://redmine.lighttpd.net/issues/2772
7 years ago
Glenn Strauss 99925202dd [mod_cgi] fix out of sockets error for POST to CGI (fixes #2771)
(thx asifgoldpk)

x-ref:
  "With mod_cgi I am getting sockets disabled, out-of-fds error"
  https://redmine.lighttpd.net/issues/2771
7 years ago
Glenn Strauss 40e05e9b8c [mod_fastcgi] fix segfault if all backends down (fixes #2768)
(thx HenrikHolst)

x-ref:
  "mod_fastcgi segfault in lighttpd-1.4.43"
  https://redmine.lighttpd.net/issues/2768
7 years ago
Glenn Strauss bb30f44530 [mod_extforward] fix crash on invalid IP (fixes #2766)
x-ref:
  "crashes for invalid IP addresses when using mod_extforward"
  https://redmine.lighttpd.net/issues/2766
7 years ago
Glenn Strauss 6533056289 [mod_cgi] FreeBSD 9.3/MacOSX does not have pipe2() (fixes #2765)
FreeBSD 9.3 has O_CLOEXEC, but does not have pipe2() until FreeBSD 10.
FreeBSD 10 also adds SOCK_CLOEXEC, so use that as indicator
https://wiki.freebsd.org/AtomicCloseOnExec

Note: FreeBSD 9.3 will soon reach its "extended" EOL date (31 Dec 2016),
so those using FreeBSD 9.3 should consider upgrading.
https://www.freebsd.org/security/security.html#sup

Mac OS X does not have pipe2().  User reported:
  Undefined symbols for architecture x86_64:
    "_pipe2", referenced from:
        _mod_cgi_handle_subrequest in mod_cgi.o

x-ref:
  "Undefined symbols _pipe2"
  https://redmine.lighttpd.net/issues/2765
7 years ago
Glenn Strauss c74bdf834b [mod_magnet] fix magnet_cgi_set() set of env vars (fixes #2763)
(thx flynn)

x-ref:
  "Setting REMOTE_USER with lua does not work"
  https://redmine.lighttpd.net/issues/2763
7 years ago
Glenn Strauss 26c44e0057 [config] warn if mod_authn_ldap,mysql not listed
warn if mod_authn_ldap is not listed in server.modules in lighttpd.conf
but auth.backend = "ldap" is in lighttpd.conf

warn if mod_authn_mysql is not listed in server.modules in lighttpd.conf
but auth.backend = "mysql" is in lighttpd.conf

A future release of lighttpd 1.4.x will cease automatically loading
these modules.  After that, lighttpd will fail to start up if
auth.backend requires one of these modules and the module is not loaded.

(The purpose of this change is to remove from the lighttpd core server
 the dependencies on LDAP or MariaDB libraries.)
7 years ago
Stefan Bühler d352790331 [mod_authn_gssapi] fix memory leak 7 years ago
Stefan Bühler 5e3653dc5d [mod_scgi] fix segfault (fixes #2762) 7 years ago