Commit Graph

1946 Commits (dd1ae42770eff507de724c3e787d511655e46793)
 

Author SHA1 Message Date
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
Glenn Strauss b482bfd1b8 graceful shutdown without unnecessary 1 sec delay 7 years ago
Glenn Strauss fd6a66b463 [doc] NEWS 7 years ago
Glenn Strauss af304330e7 [mod_webdav] remove excess SQL param to UNLOCK 7 years ago
Glenn Strauss 69ec5728f9 use con->conf.server_tag in modules
do not expose server info server_tag is configured by admin

default con->conf.server_tag is still PACKAGE_DESC, those
admin can configure server.tag otherwise.

(these changes reduce recompilation and relinking when switching
 brances in source control)
7 years ago
Glenn Strauss 8dcbd61a45 [cygwin] fix mod_proxy and mod_fastcgi ioctl use
cygwin does not support ioctl on sockets, returning EOPTNOTSUPP
(would be better if cygwin used Windows ioctlsocket() instead)

Windows uses signed (socklen_t), so add some casts to quiet warnings

Windows path handling is convoluted, so disable one tests in mod_fastcgi
since trailing spaces are removed from URL for _WIN32 and __CYGWIN__ in
response.c
7 years ago
Glenn Strauss 72b133f595 fix errors detected by Coverity Scan
buffer.c:itostr() undefined behavior taking modulus of negative number

additional minor code changes made to quiet other coverity warnings
(false positives)
7 years ago
Glenn Strauss 1a18669d53 chunkqueue_append_chunkqueue()
(simpler than chunkqueue_steal() for transferring entire chunkqueue)
7 years ago
Glenn Strauss 16a3f3b6fc [build] update Makefile.am EXTRA_DIST w/ new files 7 years ago
Glenn Strauss 879a282de7 fix errors detected by Coverity Scan
fd leak in mod_dirlisting.c
use after free in error condition in mod_proxy.c
NULL pointer dereference in error message in chunk.c

additional minor code changes made to quiet other coverity warnings
7 years ago
Glenn Strauss b14e1f16f0 asynchronous, bidirectional streaming options
asynchronous, bidirectional streaming support for request and response
Merge branch 'bug-949-streaming-request-response' into gmaster

github: closes #66
7 years ago
Glenn Strauss 5863cb5752 defer choosing "Transfer-Encoding: chunked"
defer choosing "Transfer-Encoding: chunked" until response header
is about to be written
7 years ago
Glenn Strauss bfac0285a7 remove excess calls to joblist_append()
(recent commits streamlined dynamic handler flow control)
7 years ago
Glenn Strauss 4ef4baa59d http_response_backend_error()
consolidate repeated code in dynamic handlers which manipulates
con->file_finished.  Centralize calls to http_chunk_close().

(mod_cgi, mod_fastcgi, mod_scgi, mod_proxy)
7 years ago
Glenn Strauss 923688d2da drain backend socket/pipe bufs upon FDEVENT_HUP
(mod_cgi, mod_fastcgi, mod_scgi, mod_proxy)
7 years ago
Glenn Strauss 18a7b2be37 [core] option to stream response body to client (fixes #949, #760, #1283, #1387)
Set server.stream-response-body = 1 or server.stream-response-body = 2
to have lighttpd stream response body to client as it arrives from the
backend (CGI, FastCGI, SCGI, proxy).

default: buffer entire response body before sending response to client.
(This preserves existing behavior for now, but may in the future be
 changed to stream response to client, which is the behavior more
 commonly expected.)

x-ref:
  "fastcgi, cgi, flush, php5 problem."
  https://redmine.lighttpd.net/issues/949
  "Random crashing on FreeBSD 6.1"
  https://redmine.lighttpd.net/issues/760
  "Memory usage increases when proxy+ssl+large file"
  https://redmine.lighttpd.net/issues/1283
  "lighttpd+fastcgi memory problem"
  https://redmine.lighttpd.net/issues/1387
7 years ago
Glenn Strauss ddfae019cb separate routines for reading output from backends
move code in dynamic handlers (CGI, FastCGI, SCGI, proxy)
from *_handle_fdevent() to *_recv_response() for reuse
outside the *_handle_fdevent() routine
7 years ago
Glenn Strauss f69f209e6d [core] option to stream request body to backend (fixes #376)
Set server.stream-request-body = 1 or server.stream-request-body = 2
to have lighttpd connect to backend (CGI, FastCGI, SCGI, proxy)
immediately after parsing request headers, and to stream request body
as it arrives.

default: buffer entire request body before connecting to backend,
in order to avoid tying up (limited) backend resources which are often
implemented using libraries which wait for entire request body before
proceeding.

x-ref:
  "Reimplement upload (POST) handling to match apache/zeus/thttpd/boa functionality"
  https://redmine.lighttpd.net/issues/376
7 years ago
Glenn Strauss 695c8f4e07 [config] config options to stream request/response (#949, #376)
This allows admin to configure if response is collected in entirety
prior to sending data to client

For compatibility with existing configs, default is existing behavior:
  buffer entire response prior to sending data to client

The following are config options, though not all implemented yet

// default: buffer entire request body before connecting to backend
server.stream-request-body = 0

// stream request body to backend; buffer to temp files
server.stream-request-body = 1

// stream request body to backend; minimal buffering might block upload
server.stream-request-body = 2

// default: buffer entire response body before sending to client
server.stream-request-body = 0

// stream response body to client; buffer to temp files
server.stream-request-body = 1

// stream response body to client; minimal buffering might block backend
server.stream-request-body = 2

x-ref:
  "fastcgi, cgi, flush, php5 problem."
  https://redmine.lighttpd.net/issues/949
 "Reimplement upload (POST) handling to match apache/zeus/thttpd/boa functionality"
  https://redmine.lighttpd.net/issues/376
7 years ago
Glenn Strauss 5ab7944d34 [TLS] release openssl buffers as used (fixes #1265, fixes #1283, #881)
use SSL_MODE_RELEASE_BUFFERS (OpenSSL >= 1.0.0) to free buffers
as they are used, to potentially reduce memory footprint of
idle SSL connections

x-ref:
  "memory usage when ssl.engine used and large data uploaded through CGI"
  https://redmine.lighttpd.net/issues/881
  "SSL + file upload = lots of memory"
  https://redmine.lighttpd.net/issues/1265
  "Memory usage increases when proxy+ssl+large file"
  https://redmine.lighttpd.net/issues/1283
7 years ago
Glenn Strauss 53f550b290 [core] stream response to client (#949)
This replaces buffering entire response prior to sending data to client

x-ref:
  "fastcgi, cgi, flush, php5 problem."
  https://redmine.lighttpd.net/issues/949
7 years ago
Glenn Strauss 5a91fd4b90 [core] buffer large responses to tempfiles (fixes #758, fixes #760, fixes #933, fixes #1387, #1283, fixes #2083)
This replaces buffering entire response in memory which might lead to
huge memory footprint and possibly to memory exhaustion.

use tempfiles of fixed size so disk space is freed as each file sent

update callers of http_chunk_append_mem() and http_chunk_append_buffer()
to handle failures when writing to tempfile.

x-ref:
  "memory fragmentation leads to high memory usage after peaks"
  https://redmine.lighttpd.net/issues/758
  "Random crashing on FreeBSD 6.1"
  https://redmine.lighttpd.net/issues/760
  "lighty should buffer responses (after it grows above certain size) on disk"
  https://redmine.lighttpd.net/issues/933
  "Memory usage increases when proxy+ssl+large file"
  https://redmine.lighttpd.net/issues/1283
  "lighttpd+fastcgi memory problem"
  https://redmine.lighttpd.net/issues/1387
  "Excessive Memory usage with streamed files from PHP"
  https://redmine.lighttpd.net/issues/2083
7 years ago
Glenn Strauss 4f6bd42268 [mod_webdav] create file w/ LOCK request if ENOENT
(apply to wider scope)

Also, track creation of Destination to return proper
201 Created or 204 No Content (in order to pass more 'litmus' tests)
7 years ago
Glenn Strauss 34fbc868cf [mod_webdav] getetag and lockdiscovery live props
support getetag and lockdiscovery live properties in propfind requests
7 years ago
Glenn Strauss 488688301e [doc] NEWS 7 years ago
Glenn Strauss aee88d6916 [mod_webdav] create file w/ LOCK request if ENOENT
mod_webdav now works with davfs2 mounts on Linux
7 years ago
Glenn Strauss 4eeeb8fc76 [config] server.bsd-accept-filter option
BSD accept() filters

server.bsd-accept-filter = ""           (default)
server.bsd-accept-filter = "httpready"
server.bsd-accept-filter = "dataready"

Note: this is a behavior change from prior versions.
The default is now no additional accept() filter, whereas prior
versions unconditionally enabled "httpready" accept() filter

Additionally, server.defer-accept (Linux) is inherited from global scope
into $SERVER["socket"] blocks

github: closes #65
7 years ago
Glenn Strauss f3e36ccdbb use buffer_string_set_length() to truncate strings 7 years ago
Glenn Strauss df8032a7c8 use buffer_string_set_length() to truncate strings 7 years ago
Glenn Strauss c463860451 minor: quiet some compiler warnings 7 years ago
Glenn Strauss bb93414a23 [build_cmake] use MODULE on Mac OS X (fixes #1761)
add instructions in INSTALL to build using CMake and Xcode on Mac OS X
  along with MacPorts
update CMake to link test_configfile with pcre

x-ref:
  "loadable-module naming on macosx + cmake"
  https://redmine.lighttpd.net/issues/1761
7 years ago
Glenn Strauss e8dd8fdb53 [config] normalize IP strings in lighttpd.conf
normalize IP strings in lighttpd.conf conditionals:
  $SERVER["socket"], $HTTP["remoteip"], and $HTTP["host"]
7 years ago
Glenn Strauss b47494d4cd [config] opts for http header parsing strictness (fixes #551, fixes #1086, fixes #1184, fixes #2143, #2258, #2281, fixes #946, fixes #1330, fixes #602, #1016)
server.http-parseopt-header-strict  = "enable"
server.http-parseopt-host-strict    = "enable"  (implies host-normalize)
server.http-parseopt-host-normalize = "disable"

defaults retain current behavior, which is strict header parsing
and strict host parsing, with enhancement to normalize IPv4 address
and port number strings.

For lighttpd tests, these need to be enabled (and are by default)
For marginally faster HTTP header parsing for benchmarks, disable these.

To allow
  - underscores in hostname
  - hypen ('-') at beginning of hostname
  - all-numeric TLDs
  server.http-parseopt-host-strict    = "disable"

x-ref:
  "lighttpd doesn't allow underscores in host names"
  https://redmine.lighttpd.net/issues/551
  "hyphen in hostname"
  https://redmine.lighttpd.net/issues/1086
  "a numeric tld"
  https://redmine.lighttpd.net/issues/1184
  "Numeric tld's"
  https://redmine.lighttpd.net/issues/2143
  "Bad Request"
  https://redmine.lighttpd.net/issues/2258
  "400 Bad Request when using Numeric TLDs"
  https://redmine.lighttpd.net/issues/2281

To allow a variety of numerical formats to be converted to IP addresses
  server.http-parseopt-host-strict    = "disable"
  server.http-parseopt-host-normalize = "enable"

x-ref:
  "URL encoding leads to "400 - Bad Request""
  https://redmine.lighttpd.net/issues/946
  "400 Bad Request when using IP's numeric value ("ip2long()")"
  https://redmine.lighttpd.net/issues/1330

To allow most 8-bit and 7-bit chars in headers
  server.http-parseopt-header-strict  = "disable"  (not recommended)

x-ref:
  "Russian letters not alowed?"
  https://redmine.lighttpd.net/issues/602
  "header Content-Disposition with russian '?' (CP1251, ascii code 255) causes error"
  https://redmine.lighttpd.net/issues/1016
7 years ago
Glenn Strauss b29c8efcb9 [mod_fastcgi] no chunked response w/ X-Sendfile (fixes #2733)
x-ref:
  "X-LIGHTTPD-send-file return 0 bytes"
  https://redmine.lighttpd.net/issues/2733
7 years ago
Glenn Strauss c55cf3df10 [mod_cgi,mod_scgi] X-Sendfile sets file_started (fixes #2733)
x-ref:
  "X-LIGHTTPD-send-file return 0 bytes"
  https://redmine.lighttpd.net/issues/2733
7 years ago
Glenn Strauss fde843f63e [mod_ssi] fix parse of tag across buf boundary (fixes #2732)
thx fbrosson

x-ref:
  "char copied to wrong place in SSI output"
  https://redmine.lighttpd.net/issues/2732
7 years ago
Glenn Strauss a8c51b0cbe [core] wrap IPv6 literal in "[]" in redirect URL 7 years ago
Glenn Strauss a5fcfee6fc [mod_ssi] more flexible quoting (fixes #1768)
allow double-quotes, single-quotes or no quote on SSI param values

remove use of PCRE from mod_ssi

fix misspelling of 'unknow' to be 'unknown'

x-ref:
  "mod_ssi doesn't accept single quotes"
  https://redmine.lighttpd.net/issues/1768
7 years ago
Glenn Strauss abfb9d9e2d [mod_ssi] add PCRE_* options to constrain regex 7 years ago
Glenn Strauss ede4d17913 [mod_ssi] include relative to alias,userdir (fixes #222)
adjust paths relative to changes made by mod_alias and mod_userdir

Note: this still works only for direct file inclusion.
lighttpd mod_ssi does not perform an "internal subrequest" for the
virtual path, so things like virtual include of CGI are not supported

x-ref:
  "ssi virtual include uses wrong path"
  https://redmine.lighttpd.net/issues/222
7 years ago
Glenn Strauss df146a7724 [mod_ssi] fix SSI statement parser
bug introduced in 8e3c6bf7 when statement parser was replaced
7 years ago