Commit Graph

1986 Commits (bce293e4a7b2a3d9d6518260c74dc3cb7233e342)
 

Author SHA1 Message Date
Glenn Strauss bce293e4a7 [TLS] better handling of SSL_ERROR_WANT_READ/WRITE
better handling of SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE
7 years ago
Glenn Strauss 565dec2ff1 [core] consolidate duplicated response_end code 7 years ago
Glenn Strauss 38139fa1a9 [core] permit IPv6 address scope identifier
getaddrinfo() on permits a scope identifier to be part of the IPv6
address string, so permit this syntax in $SERVER["socket"] validation.

x-ref:
https://tools.ietf.org/html/rfc4007#section-11
https://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices
7 years ago
Glenn Strauss 9af58a9716 revert 1.4.40 swap of REQUEST_URI, REDIRECT_URI (fixes #2738)
reverts part of commit:dbdab5db which swapped REQUEST_URI, REDIRECT_URI

x-ref:
  "mediawiki redirect loop if REQUEST_URI not orig req in 1.4.40"
  https://redmine.lighttpd.net/issues/2738

Explanation:

REQUEST_URI and REDIRECT_URI are not part of CGI standard environment.
The reason for their existence is that PATH_INFO in CGI environment may
be different from the path in the current request.  The main reason for
this potential difference is that the URI path is normalized to a path
in the filesystem and tested against the filesystem to determine which
part is SCRIPT_NAME and which part is PATH_INFO.  In case-insensitive
filesystems, the URI might be lowercased before testing against the
filesystem, leading to loss of case-sensitive submission in any
resulting PATH_INFO.  Also, duplicated slashes "///" and directory
references "/." and "/.." are removed, including prior path component in
the case of "/..".  This might be undesirable when the information after
the SCRIPT_NAME is virtual information and there target script needs the
virtual path preserved as-is.  In that case, the target script can
re-parse REQUEST_URI (or REDIRECT_URI, as appropriate) to obtain the
unmodified information from the URI.

con->request.uri is equivalent to con->request.orig_uri unless the
request has been internally rewritten (e.g. by mod_rewrite, mod_magnet,
others), in which case con->request.orig_uri is the request made by the
client, and con->request.uri is the current URI being processed.

Historical REQUEST_URI (environment variable) lighttpd inconsistencies
- mod_cml     set REQUEST_URI to con->request.orig_uri
- mod_cgi     set REQUEST_URI to con->request.orig_uri
- mod_fastcgi set REQUEST_URI to con->request.orig_uri
- mod_scgi    set REQUEST_URI to con->request.orig_uri

- mod_ssi     set            REQUEST_URI to current con->request.uri
- mod_magnet  set MAGNET_ENV_REQUEST_URI to current con->request.uri
              and MAGNET_ENV_REQUEST_ORIG_URI to con->request.orig_uri

Historical REDIRECT_URI (environment variable) previously set only in
mod_fastcgi and mod_scgi, and set to con->request.uri

Since lighttpd 1.4.40 provides REDIRECT_URI with con->request.orig_uri,
changes were made to REQUEST_URI for consistency, with the hope that
there would be little impact to existing configurations since the
request uri and original request uri are the same unless there has been
an internal redirect.  It turns out that various PHP frameworks use
REQUEST_URI and require that it be the original URI requested by client.

Therefore, this change is being reverted, and lighttpd will set
REQUEST_URI to con->request.orig_uri in mod_cgi, mod_fastcgi, mod_scgi
as was done in lighttpd 1.4.39 and earlier.  Similarly, REDIRECT_URI
also has the prior behavior in mod_fastcgi and mod_scgi, and added to
mod_cgi.

A future release of lighttpd might change mod_ssi to be consistent with
the other modules in setting REQUEST_URI to con->request.orig_uri and to
add REDIRECT_URI, when an internal redirect has occurred.
7 years ago
Glenn Strauss ed340897a2 do not set REDIRECT_URI in mod_magnet, mod_rewrite (#2738)
reverts commit:b473220d

x-ref:
  "mediawiki redirect loop if REQUEST_URI not orig req in 1.4.40"
  https://redmine.lighttpd.net/issues/2738
7 years ago
Glenn Strauss b43fc006be [mod_status] show keep-alive status w/ text output (fixes #2740)
x-ref:
  "mod_status with "?auto" modifier not showing keep-alive (k) status
on Scoreboard"
  https://redmine.lighttpd.net/issues/2740
  "server-status - additional stats - keepalive"
  https://redmine.lighttpd.net/issues/1202
7 years ago
Glenn Strauss cd33554b74 [core] $HTTP["remoteip"] must handle IPv6 w/o []
[core] $HTTP["remoteip"] must handle IPv6 w/o [] (existing behavior)
This was inadvertently broken in lighttpd 1.4.40 when IP address
normalization was added.

In $HTTP["remoteip"], IPv6 is now accepted with or without '[]'.
http_request_host_normalize() expects IPv6 with '[]', and config
processing at runtime expects COMP_HTTP_REMOTE_IP compared without '[]',
so '[]' is stripped (internally) after normalization
7 years ago
Glenn Strauss cb468d333c [core] stay in CON_STATE_CLOSE until done with req
Do not switch to CON_STATE_ERROR upon idle timeout if already in
CON_STATE_CLOSE.  Changing to CON_STATE_ERROR might keep resetting
con->close_timeout_ts if repeated calls to shutdown() succeed.
7 years ago
Glenn Strauss 78c79ead4a [core] avoid spurious trace and error abort
HANDLER_COMEBACK and HANDLER_ERROR are valid return values
from dynamic fdevent handlers.  Do not abort if HANDLER_ERROR
is returned.
7 years ago
Glenn Strauss 1ebc83f11f [build_cmake] clock_gettime() -lrt w/ glibc < 2.17 (fixes #2737)
clock_gettime() needs -lrt with glibc < 2.17,
and possibly other platforms

This commit contains fixes for CMake and SCONS
See also commit:4d920466 which updated configure.ac for same

x-ref:
  "1.4.40 compiling issuses on Debian Wheezy"
  https://redmine.lighttpd.net/issues/2737
7 years ago
Glenn Strauss 779c133c16 [security] do not emit HTTP_PROXY to CGI env
Strip bogus "Proxy" header before creating subprocess environment.
(mod_cgi, mod_fastcgi, mod_scgi, mod_ssi, mod_proxy)

Do not emit HTTP_PROXY to subprocess environment.
Some executables use HTTP_PROXY to configure outgoing proxy.

This is not a lighttpd security issue per se, but this change to
lighttpd adds a layer of defense to protect backend processes which
might be vulnerable due to blindly using this untrusted environment
variable.  The HTTP_PROXY environment variable should not be trusted
by a program running in a CGI-like environment.

Mitigation in lighttpd <= 1.4.40 is to reject requests w/ Proxy header:

* Create "/path/to/deny-proxy.lua", read-only to lighttpd, with content:
  if (lighty.request["Proxy"] == nil) then return 0 else return 403 end
* Modify lighttpd.conf to load mod_magnet and run lua code
    server.modules += ( "mod_magnet" )
    magnet.attract-raw-url-to = ( "/path/to/deny-proxy.lua" )

References:

https://www.kb.cert.org/vuls/id/797896
CGI web servers assign Proxy header values from client requests to
internal HTTP_PROXY environment variables

https://httpoxy.org/
httpoxy: A CGI application vulnerability
7 years ago
Glenn Strauss d506f4a569 minor: spelling changes in some comments/messages 7 years ago
Glenn Strauss 4d920466f7 [autobuild] clock_gettime() -lrt with glibc < 2.17
clock_gettime() needs -lrt with glibc < 2.17,
and possibly other platforms

On systems without clock_gettime (-cough- Mac OSX -cough-),
use gettimeofday() (deprecated in POSIX.1-2008) which is slightly
lower precision, but reasonably fast in execution.  References:
http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x
http://stackoverflow.com/questions/11680461/monotonic-clock-on-osx
https://discussions.apple.com/thread/6023936?tstart=0
7 years ago
Glenn Strauss a3ec906ef9 [core] #include <sys/filio.h> for FIONREAD (fixes #2726)
illumos (OpenIndiana) gets FIONREAD from <sys/filio.h>

x-ref:
  "lighttpd 1.4.40 compilation fails on illumos (OpenIndiana)"
  https://redmine.lighttpd.net/issues/2735
7 years ago
fbrosson 72abc87b40 [autobuild] move inet_pton detection later
HAVE_INET_PTON was probably not being defined on Solaris.

While at it, also add detection for accept() in libnetwork for Haiku.

github: closes #68
7 years ago
Glenn Strauss 9c49dc9a5c workaround clang compiler warning 7 years ago
Glenn Strauss acad2c903a fix some warnings reported by cppcheck
fix some warnings reported by cppcheck and
change mod_skeleton.c to use buffer_string_length()
7 years ago
Glenn Strauss 393dfd8cb9 [mod_ssi] fix #config sizefmt="bytes" 7 years ago
Glenn Strauss adf91591fc [doc] update memcache references to memcached 7 years ago
Glenn Strauss 00cc4d7c0e [mod_auth] fix Digest auth to be better than Basic (fixes #1844)
Make Digest authentication more compliant with RFC.

Excerpt from https://www.rfc-editor.org/rfc/rfc7616.txt Section 5.13:
    The bottom line is that any compliant implementation will be
    relatively weak by cryptographic standards, but any compliant
    implementation will be far superior to Basic Authentication.

x-ref:
  "Serious security problem in Digest Authentication"
  https://redmine.lighttpd.net/issues/1844
7 years ago
Glenn Strauss 052a049f29 [build] allow AUTHOR, KEYID overrides to packdist 7 years ago
Glenn Strauss 2cdc017fb9 [config] inherit server.use-ipv6 and server.set-v6only (fixes #678)
inherit server.use-ipv6 and server.set-v6only from global scope
into $SERVER["socket"] blocks

(This potential behavior change was announced with lighttpd 1.4.40)

x-ref:
  "$SERVER["socket"] to bind to IPv6 by default"
  https://redmine.lighttpd.net/issues/678
7 years ago
Glenn Strauss e9c9f42564 remove long-deprecated, non-functional config opts 7 years ago
Glenn Strauss 8f8fa606ca - next is 1.4.41 7 years ago
Glenn Strauss 268c5582b2 [doc] NEWS 7 years ago
Glenn Strauss ee708db9fd [doc] add self to AUTHORS (discussed w/ stbuehler) 7 years ago
Glenn Strauss a83bae5bd2 update lighttpd -h 7 years ago
Glenn Strauss 8861c2bb54 [mod_cgi] handle local redirect response (fixes #2108)
RFC3875 CGI 1.1 specification section 6.2.2 Local Redirect Response
http://www.ietf.org/rfc/rfc3875

x-ref:
  "CGI local redirect not implemented correctly"
  https://redmine.lighttpd.net/issues/2108
7 years ago
Glenn Strauss bcddcf8b0e [tests] remove some tests duplicated in mod-cgi.t 7 years ago
Glenn Strauss 86cd135b25 [core] fdevent_libev: workaround compiler warning
workaround compiler warning w/ gcc -Wstrict-aliasing=2 -fstrict-aliasing
7 years ago
Glenn Strauss bd8b58cea5 [core] fdevent_libev: update use of ev_timer 7 years ago
Glenn Strauss ce7d040bf3 [mod_access] new directive url.access-allow (fixes #1421)
url.access-allow is list of allowed url suffixes (e.g. file extensions)
If url.access-allow has been set, then deny any URL that does not match
the explicitly listed suffixes.

(thx japc)

x-ref:
  "access_allow directive for lighttpd"
  https://redmine.lighttpd.net/issues/1421
7 years ago
Glenn Strauss 5e76b284df [mod_accesslog] %a %A %C %D %k %{}t %{}T (fixes #1145, fixes #1415, fixes #2081)
add support for additional commonly-used accesslog format flags

x-ref:
  "mod_accesslog cookie field support %{VARNAME}C"
  https://redmine.lighttpd.net/issues/1145
  "access_log : %D time used in ms (not supported)"
  https://redmine.lighttpd.net/issues/1415
  "%{format}t support"
  https://redmine.lighttpd.net/issues/2081
7 years ago
Glenn Strauss a714f4f720 fix gcc 6.1.1 compiler warn misleading-indentation 7 years ago
Glenn Strauss c1af146a6e [mod_fastcgi,mod_scgi] check for spawning on same unix socket (#319)
error out if duplicated unix socket path and different bin-path is
used by lighttpd to start the backend.  This is an error.
Updates commits 97556d99 and b67ff2aa

x-ref:
  "Should warn if two FastCGI servers point to same socket file"
  https://redmine.lighttpd.net/issues/319
7 years ago
Glenn Strauss b67ff2aaca [mod_fastcgi,mod_scgi] check for spawning on same unix socket (#319)
silently use same 'host' if unix socket path is duplicated
(instead of erroring out).  Updates commit 97556d99

(It is possible for use of += in config to result in duplicated
 fastcgi.server and scgi.server entries)

x-ref:
  "Should warn if two FastCGI servers point to same socket file"
  https://redmine.lighttpd.net/issues/319
7 years ago
Glenn Strauss fe02be7e34 [core] make server.max-request-size scopeable (fixes #1901)
x-ref:
  "make server.max-request-size scopeable"
  https://redmine.lighttpd.net/issues/1901
7 years ago
Glenn Strauss 3d98e0b61a [mod_uploadprogress] fix mem leak (#1858)
fix memory leak
reduce code redundancy
convert code to use newer buffer.h APIs
proper cleanup if upload cancelled or client disconnected
change "starting" message to "not in progress" if upload not in progress
7 years ago
Glenn Strauss 1cb30900f3 [core] remove assert in fdevent_unregister()
assumptions changed: fdn->events can be 0 with server streaming
request and/or response.
7 years ago
Glenn Strauss 53d906968b [autobuild] CMake check for struct tm tm_gmtoff (fixes #2014)
x-ref:
  "cmake scripts don't HAVE_STRUCT_TM_GMTOFF -> wrong timezone"
  https://redmine.lighttpd.net/issues/2014
7 years ago
Glenn Strauss dd1ae42770 [mod_webdav] fix proppatch mem leak, other fixes (#fixes 1334, #fixes 2000)
x-ref:
  "mod_webdav returns Not Implemented when DELETE fails on permissions error"
  https://redmine.lighttpd.net/issues/1334
  "webdav: Define resourcetype for resources other than collections"
  https://redmine.lighttpd.net/issues/2000
7 years ago
Glenn Strauss 28841bfc3d [core] fix server.max-request-size to be precise (fixes #2131)
(previously would allow up to 1k data above configured limit)

x-ref:
  "max-request-size comparing mistake"
  https://redmine.lighttpd.net/issues/2131
7 years ago
Glenn Strauss d6c60ebbff [TLS] fix return value checks during cert init
openssl interfaces typically return 1 to indicate success,
with varying return values to indicate failure
(sometimes 0, sometimes 'not 1')

(thx mackyle)
7 years ago
Glenn Strauss 340e9aefa0 [core] fix s6_addr type-punned compiler warning
(older gcc compilers)
7 years ago
Glenn Strauss d147673d40 [tests] remove dependency on CGI.pm
CGI.pm is no longer shipped as part of Perl core distribution
(and is easily replaced)
7 years ago
Glenn Strauss c489dd6cc4 [cygwin] minor: fix compiler warning 7 years ago
Glenn Strauss c916b2fc11 [build] add $(ATTR_LIB) to liblightcomp_la_LIBADD
(for cygwin)
7 years ago
Glenn Strauss 5ce7b2df5c [core] add declarations to fdevent.h (#2373)
(follow-up to 79bcfab0)

x-ref:
  "FreeBSD build with libev broken"
  https://redmine.lighttpd.net/issues/2373
7 years ago
Glenn Strauss 416b5729fb [core] disable Nagle algorithm (TCP_NODELAY)
disable Nagle algorithm (TCP_NODELAY) on client sockets
7 years ago
Glenn Strauss eefb94bb39 fix error handling for portability (NetBSD)
thx joerg
7 years ago