Commit Graph

96 Commits

Author SHA1 Message Date
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
2016-07-09 11:01:13 -04:00
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)
2016-06-25 18:52:06 -04:00
Glenn Strauss 4edb65cfa1 [core] preserve PATH_INFO case on case-insensitive fs (fixes #406)
attempt to preserve PATH_INFO case even when the
URI is mapped onto a case-insensitive file system.

NTFS (Windows) is case-insensitive (even though it is case-preserving)
HFS+ (Mac OS X) can be formatted to be case-insensitive

x-ref:
  "... PATH_INFO ... improperly converted to lowercase"
  https://redmine.lighttpd.net/issues/406
2016-04-28 13:23:29 -04:00
Glenn Strauss 49c74fff65 [core] compile with upcoming openssl 1.1.0 release (fixes #2727)
(thx falemagn)

x-ref:
  "Won't compile with OpenSSL 1.1.0"
  https://redmine.lighttpd.net/issues/2727
2016-04-24 20:28:03 -04:00
Glenn Strauss 4db255ca39 make (compile and link) cleanly under cygwin 2016-04-24 20:24:28 -04:00
Glenn Strauss 8f27ff8cd4 defer reading request body until handle subrequest
read request body in dynamic handlers supporting request body
(mod_cgi, mod_fastcgi, mod_proxy, mod_scgi, mod_webdav)

(In the future, each dynamic handler might choose whether or not to
 buffer request body or to stream request body to backend as request
 body is received.)

modify mod_webdav to mark request in handle_physical hook, and move
the main logic to handle_subrequest hook, where the main logic is
for other dynamic handlers.
2016-04-18 06:19:03 -04:00
Glenn Strauss c263bc6a11 defer reading request body until handle subrequest (fixes #2541)
read request body right before calling subrequest handler,
allowing request to be handled prior to reading request body,
e.g. to send 401 Unauthorized response when authentication is required

(In the future, this might move into each dynamic handler which supports
 request body (mod_cgi, mod_fastcgi, mod_proxy, mod_scgi, mod_webdav) so
 that each dynamic handler can choose whether or not to buffer request
 body or to stream request body to backend as request body is received.)

keep-alive is disabled if request body has not been completely read
prior to sending response

x-ref:
  "HTTP 401 Unauthorized only sent back after full POST request is read"
  https://redmine.lighttpd.net/issues/2541
2016-04-18 06:19:03 -04:00
Glenn Strauss 8abd06a7ff consistent inclusion of config.h at top of files (fixes #2073)
From: Glenn Strauss <gstrauss@gluelogic.com>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3113 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-19 15:14:35 +00:00
Stefan Bühler c033a1966e [core] improve conditional enabling (thx Gwenlliana, #2598)
instead of looping over all config blocks for each conditional var that
gets enabled, enable them all and run over them once.

Right now it seems we actually set all variables at once in normal
config handling (SNI only sets a subset); future modifications
might introduce new variables which are activated at a later stage
(physical path related for example).

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3083 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-02-21 18:32:17 +00:00
Stefan Bühler ad3e93ea96 Use buffer API to read and modify "used" member
- a lot of code tried to handle manually adding terminating zeroes and
  keeping track of the correct "used" count.
  Replaced all "external" usages with simple wrapper functions:
  * buffer_string_is_empty (used <= 1), buffer_is_empty (used == 0);
    prefer buffer_string_is_empty
  * buffer_string_set_length
  * buffer_string_length
  * CONST_BUF_LEN() macro
- removed "static" buffer hacks (buffers pointing to constant/stack
  memory instead of malloc()ed data)
- buffer_append_strftime(): refactor buffer+strftime uses
- li_tohex(): no need for a buffer for binary-to-hex conversion:
  the output data length is easy to predict
- remove "-Winline" from extra warnings: the "inline" keyword just
  supresses the warning about unused but defined (static) functions;
  don't care whether it actually gets inlined or not.

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2979 152afb58-edef-0310-8abb-c4023f1b3aa9
2015-02-08 19:10:44 +00:00
Stefan Bühler 4365bdbebe Remove buffer_prepare_copy() and buffer_prepare_append()
* removed almost all usages of buffer as "memory" (without terminating
  zero)
* refactored cgi variable name encoding

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2977 152afb58-edef-0310-8abb-c4023f1b3aa9
2015-02-08 19:10:39 +00:00
Stefan Bühler 1be163b44a Remove chunkqueue_get_{append,prepend}* API
Although those were "easy" to use, they violated the abstraction:
  content of the chunkqueue should only be modified via the API.
  Replace with chunkqueue_get_memory() and chunkqueue_use_memory() for
  functions that read data from network (reusing large buffers),
  chunkqueue_steal_with_tempfiles() to store request bodies on disk
  temporarily.
  Modules that were generating content and need a buffer maintain the
  buffer manually (have to be careful to free the buffer on errors, as
  it isn't part of the chunkqueue yet).

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2976 152afb58-edef-0310-8abb-c4023f1b3aa9
2015-02-08 19:10:36 +00:00
Stefan Bühler 6afad87d2e fix buffer, chunk and http_chunk API
* remove unused structs and functions
    (buffer_array, read_buffer)
  * change return type from int to void for many functions,
    as the return value (indicating error/success) was never checked,
    and the function would only fail on programming errors and not on
    invalid input; changed functions to use force_assert instead of
    returning an error.
  * all "len" parameters now are the real size of the memory to be read.
    the length of strings is given always without the terminating 0.
  * the "buffer" struct still counts the terminating 0 in ->used,
    provide buffer_string_length() to get the length of a string in a
    buffer.
    unset config "strings" have used == 0, which is used in some places
    to distinguish unset values from "" (empty string) values.
  * most buffer usages should now use it as string container.
  * optimise some buffer copying by "moving" data to other buffers
  * use (u)intmax_t for generic int-to-string functions
  * remove unused enum values: UNUSED_CHUNK, ENCODING_UNSET
  * converted BUFFER_APPEND_SLASH to inline function (no macro feature
    needed)
  * refactor: create chunkqueue_steal: moving (partial) chunks into another
    queue
  * http_chunk: added separate function to terminate chunked body instead of
    magic handling in http_chunk_append_mem().
    http_chunk_append_* now handle empty chunks, and never terminate the
    chunked body.

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2975 152afb58-edef-0310-8abb-c4023f1b3aa9
2015-02-08 12:37:10 +00:00
Stefan Bühler f0e5c1415d [core] decode URL before rewrite, enabling it to work in $HTTP["url"] conditionals (fixes #2526)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2927 152afb58-edef-0310-8abb-c4023f1b3aa9
2014-01-10 12:04:59 +00:00
Stefan Bühler 17762fad01 maintain physical.basedir (the "acting" doc-root as prefix of physical.path) in more places
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2926 152afb58-edef-0310-8abb-c4023f1b3aa9
2014-01-10 12:04:57 +00:00
Stefan Bühler 4938c94ada fix typo (fixes #2519)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2916 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-11-10 13:49:47 +00:00
Stefan Bühler 9cfc080ab7 [core] allow files to be used as document-root (fixes #2475)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2900 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-08-30 15:02:44 +00:00
Stefan Bühler 559b198f86 [auth] put REMOTE_USER into cgi environment, making it accessible to lua via lighty.req_env (fixes #2495)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2892 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-08-30 13:14:52 +00:00
Stefan Bühler 05858f6cf2 [ssl] Fix $HTTP["scheme"] conditional, could be "http" for ssl connections if the ssl $SERVER["socket"] conditional was nested (fixes #2501)
con->conf.is_ssl got removed and replaced by:
 * con->conf.ssl_enabled for the config var "ssl.engine" - it is only
   used to determine which server-sockets should use ssl. (usually not
   needed as it is mandatory and enough to set ssl.pemfile anyway)
 * con->srv_socket->is_ssl to detect the actual ssl status of the
   bound socket, which is the same as the ssl status of the connection
 * con->uri.scheme for the actual $HTTP["scheme"] value, also used for
   the CGI "HTTPS=ON" variable. This defaults to "https" if the
   connection uses ssl, but can be changed for example by mod_extforward
   if X-Forwarded-Proto: is set to either "http" or "https" (other values
   are ignored right now)

Also removed the broken srv_socket->is_proxy_ssl as it was a connection
value in a server_socket struct...

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2887 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-07-31 20:23:21 +00:00
Stefan Bühler d09fdd877f Handle ENAMETOOLONG, return 404 Not Found (fixes #2396, thx dererkazo)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2850 152afb58-edef-0310-8abb-c4023f1b3aa9
2012-11-07 13:07:00 +00:00
Stefan Bühler a0b5391e77 Fix var declarations mixed in source
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2721 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-04-13 16:21:21 +00:00
Stefan Bühler a48aa0f023 Check uri instead of physical path for directory redirect
* should fix alias handling for "/foo" => "/var/www/";
   http://example.com/foo should result in a redirect to
   http://example.com/foo/

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2720 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-04-13 15:47:29 +00:00
Stefan Bühler e430ce09bc export some SSL_CLIENT_* vars for client cert validation (fixes #1288, thx presbrey)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2688 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-11-05 21:46:48 +00:00
Stefan Bühler 8c83976dbe mod_fastcgi: Add "X-Sendfile2" - supporting multiple ranged files (fixes #2008)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2651 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-14 17:32:38 +00:00
Stefan Bühler 22e8b456a9 Fix header inclusion order, always include "config.h" before any system header
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2624 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-11 14:31:42 +00:00
Stefan Bühler d69683ddb5 Remember keep-alive-idle in separate variable (fixes #1988)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2622 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-11 13:16:03 +00:00
Stefan Bühler b2108c436c Remove X-Sendfile-Range feature; it will be replaced with something more powerful (#2005, #2008)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2542 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-06-19 19:06:39 +00:00
Stefan Bühler e2e7fe607a Allow max-keep-alive-requests to depend on conditional (fixes #1881)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2534 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-06-11 14:09:25 +00:00
Stefan Bühler ad1e80e5af Add X-Sendfile-Range feature (fixes #2005)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2531 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-06-11 12:35:00 +00:00
Stefan Bühler 638ee6cad9 Add revision number to package version for svn/git checkouts
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2467 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-04-10 17:35:19 +00:00
Stefan Bühler 066b208bb6 Added Language conditional (fixes #1119); patch by petar
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2392 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-02-05 22:36:58 +00:00
Stefan Bühler 36f74e5d23 Revert url decoding+simplifying before matching of mod_rewrite/mod_redirect
- Lot of regressions (we forgot to reencode the result)
  - Generic problem: after decode and rewrite "a?b?c": which '?' was the path?query seperator?
  - Possible solution: only decode printable characters (without '?'), and encode the result; do not encode the '%' of a not decoded character.
  - Still a problem with path simplifying, it seems many people use urls like this: http://server1/http%3a//server2/xxx
    and rewrite the path into the querystring.
  - Probably only usable with an extra config option

  => Do NOT use rewrite/redirect to protect specific urls.


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2362 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-12-07 15:22:42 +00:00
Stefan Bühler 4db2292d50 Fix duplicate connection keep-alive/transfer-encoding headers (#960)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2326 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-10-04 16:10:29 +00:00
Stefan Bühler 9cb47be07f Fix small copy/paste typo in previous commit
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2297 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-08-27 14:53:03 +00:00
Stefan Bühler 9e6ef84e91 Do not send content-encoding for 304 (#1754), thx yzlai
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2296 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-08-20 16:44:51 +00:00
Stefan Bühler ec61ba0559 Match headers case insensitive in response (removing of X-{Sendfile,LIGHTTPD-*}, catching Date/Server)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2281 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-08-12 19:47:49 +00:00
Stefan Bühler 5547928112 Decode url before matching in mod_rewrite (#1720)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2278 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-08-02 16:24:31 +00:00
Stefan Bühler 52861d77df Replace buffer_{append,copy}_string with the _len variant where possible (#1732, thx crypt)
Replace BUFFER_{APPEND,COPY}_STRING_CONST with _len(b, CONST_STRL_LEN(x))


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2250 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-07-30 19:38:32 +00:00
Stefan Bühler fcce4c9cbb Fix comment style (use /* */ instead of //)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2151 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-04-23 13:10:41 +00:00
Stefan Bühler ff4cabbb1d Don't send empty Server headers (#1620)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2145 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-04-10 10:54:27 +00:00
Stefan Bühler 85b8153dfc Fix previous merge
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2113 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-03-02 12:59:18 +00:00
Xuefer 9ffe08a583 merged part of [1528] from trunk: added the new options and added alternative names for user-agent, remote-ip and query-string
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2112 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-03-02 11:46:44 +00:00
Stefan Bühler 40a41e3b66 Fix the fix #1324/[2086]: if no module handled a request, treat method OPTION as 200, all others as 403.
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2095 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-02-26 19:14:14 +00:00
Stefan Bühler db1b286ecd r2098@chromobil: stefan | 2008-02-26 17:12:51 +0100
Fix #1574: Check for symlinks after successful pathinfo matching.


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2093 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-02-26 16:22:08 +00:00
Stefan Bühler f350d186fc r2085@chromobil: stefan | 2008-02-26 16:14:50 +0100
Fix #1164: Reset conditional cache


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2080 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-02-26 16:19:42 +00:00
Elan Ruusamäe 95769fb3f6 - Print error if X-LIGHTTPD-send-file cannot be done; reset header Content-Length for send-file.
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2034 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-01-16 00:19:54 +00:00
Elan Ruusamäe d6b9709b54 - support for matching $HTTP["scheme"] in configs, patch from:
http://trac.lighttpd.net/trac/wiki/HowToRedirectHttpToHttps
  apparently by swiergot/at/gmail.com, adjusted for current svn.


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2012 152afb58-edef-0310-8abb-c4023f1b3aa9
2007-11-04 16:53:17 +00:00
Jan Kneschke 2fcc885f3a fixed duplicate headers as reported in the blog
- this is a partial revert of [1723]


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1767 152afb58-edef-0310-8abb-c4023f1b3aa9
2007-04-13 20:47:40 +00:00
Jan Kneschke a0436cea45 encode newlines in HTTP headers (fixes #1106)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1723 152afb58-edef-0310-8abb-c4023f1b3aa9
2007-04-09 18:12:43 +00:00
Marcus Rückert 8cd1471cb3 - white space cleanup part 2 this time 1.4 ;)
i hope it helps with merging stuff back to 1.5

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1371 152afb58-edef-0310-8abb-c4023f1b3aa9
2006-10-04 13:26:23 +00:00