Commit Graph

106 Commits (27ab3f76dbedbb48cfb84e1bfc61e403f0a2c851)

Author SHA1 Message Date
Stefan Bühler 0508bf674e fix some unchecked return value warnings
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3015 152afb58-edef-0310-8abb-c4023f1b3aa9
2015-08-22 16:01:08 +00:00
Stefan Bühler 2edec63597 #ifdef all parts belonging to the connection-state debugging
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2997 152afb58-edef-0310-8abb-c4023f1b3aa9
2015-07-05 22:00:11 +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 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 3605a3bec3 use keep-alive timeout while waiting for HTTP headers; use always the read timeout while waiting for the HTTP body
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2962 152afb58-edef-0310-8abb-c4023f1b3aa9
2014-04-02 10:04:11 +00:00
Stefan Bühler 7bd0f54ab2 add some asserts to help static analyzers
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2957 152afb58-edef-0310-8abb-c4023f1b3aa9
2014-02-16 13:08:41 +00:00
Stefan Bühler 07dd0bd0a5 add force_assert() to enforce assertions as simple assert()s are disabled by -DNDEBUG (fixes #2546)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2948 152afb58-edef-0310-8abb-c4023f1b3aa9
2014-02-16 13:08:20 +00:00
Stefan Bühler 99cddff73a [core] check success of setuid,setgid,setgroups (CVE-2013-4559)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2923 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-11-13 11:43:33 +00:00
Stefan Bühler d8b363c1d1 [stat-cache] fix FAM cleanup/fdevent handling
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2922 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-11-13 11:43:31 +00:00
Stefan Bühler 1af871fcef [ssl] fix SNI handling; only use key+cert+verify-client from SNI specific config (fixes #2525, CVE-2013-4508)
pull all ssl.ca-file values into all SSL_CTXs, but use only the local
ssl.ca-file for verify-client; correct SNI name is no requirement,
so enforcing verification for a subset of SNI names doesn't actually
protect those.

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

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2913 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-11-05 15:29:07 +00:00
Stefan Bühler 29ff92d9ba [core] set signal handlers before forking child processes in modules/plugins_call_set_defaults (fixes #2502)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2901 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-08-30 15:46:13 +00:00
Cyril Brulebois 0c6a564543 Fix non-ANSI function declarations.
The proper way to declare a function taking no parameters isn't:
  foo bar();

But this instead:
  foo bar(void);

Signed-off-by: Cyril Brulebois <kibi@debian.org>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2843 152afb58-edef-0310-8abb-c4023f1b3aa9
2012-08-31 14:11:41 +00:00
Stefan Bühler 3a13ab8bf2 Detect multiple -f options: show error message instead of assert (fixes #2416)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2836 152afb58-edef-0310-8abb-c4023f1b3aa9
2012-05-18 12:56:30 +00:00
Stefan Bühler 6f0752da38 list all network handlers in lighttpd -V (fixes #2376)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2824 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-12-27 12:14:23 +00:00
Stefan Bühler 761bedd7fe [libev/cgi] fix waitpid ECHILD errors in cgi with libev (fixes #2324)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2816 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-12-18 12:58:04 +00:00
Stefan Bühler f0816d8db2 fdevent: add solaris eventports (fixes #2171)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2796 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-06-13 17:34:57 +00:00
Stefan Bühler 55e1dc1825 [ssl/build] some minor fixes; fix compile without ssl, cleanup ssl config buffers
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2789 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-04-24 16:02:55 +00:00
Stefan Bühler 7e5b0fe9ab Rename fdevent_event_add to _set to reflect what the function does. Fix some handlers.
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2765 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-08-17 09:54:42 +00:00
Stefan Bühler 743230643e report libev handler in feature list/mod_status
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2755 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-08-07 11:03:30 +00:00
Stefan Bühler 38f2d1ddd7 cleanup fdevent code, removed linux-rtsig handler, replaced some fprintf calls
* use log functions
 * convert flags
 * fix handler callback prototype

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2752 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-08-06 21:57:15 +00:00
Stefan Bühler a61e0bdde0 Fix two compiler warnings
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2732 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-07-04 07:45:25 +00:00
Stefan Bühler 932b67bd2b Fix linger close timeout handling, drop timeout to 5 seconds (fixes #2086)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2669 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-19 13:26:01 +00:00
Stefan Bühler b987643307 Add SSL Client Certificate verification (#1288)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2654 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-14 18:19:19 +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 4df22f2a32 Fix issues found with clang analyzer
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2594 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-07-21 20:35:27 +00:00
Stefan Bühler 2ab8287e32 Fix FD_SETSIZE comparision warnings on FreeBSD
* And again, FreeBSD sucks... it defines FD_SETSIZE as an unsigned integer,
  while every fd is signed.
  This obviously breaks thinks like assert(fd < FD_SETSIZE);


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2570 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-07-10 16:16:11 +00:00
Stefan Bühler fbdb305f8a Add server.breakagelog, a "special" stderr (fixes #1863)
* The breakage-log simply replaces stderr (the old stderr is moved away if needed for errorlog),
  and stderr isn't closed after forking.
  It defaults to stderr if started with -n (no daemonize), otherwise it defaults to /dev/null.
  It is _not_ reopened in log_error_cycle, as there may be many long running childs which have it
  still open anyway. Use a pipe-logger with cycle-support if you need it.


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2550 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-06-21 17:25:39 +00:00
Stefan Bühler 7ad4792357 Add support for "real" entropy from /dev/[u]random (fixes #1977)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2524 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-06-11 09:53:34 +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 9c7cdb8011 Add proper SUID bit detection (fixes #416)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2436 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-04-09 16:51:52 +00:00
Stefan Bühler 4533af7668 Fix segfault if siginfo_t* is NULL in sigaction handler (fixes #1926)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2409 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-03-07 13:58:25 +00:00
Stefan Bühler 22bee5ad52 Silenced the annoying "request timed out" warning, enable with the "debug.log-timeouts" option (fixes #1529)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2390 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-02-05 21:54:47 +00:00
Stefan Bühler 24d08807c5 Fix max-connection limit handling/100% cpu usage (fixes #1436)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2387 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-02-05 10:53:24 +00:00
Stefan Bühler cb91487c8d Add option to ignore the "Expect: 100-continue" header instead of returning 417 Expectation failed (closes #1017)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2385 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-02-04 15:16:29 +00:00
Stefan Bühler 4456b579b7 Use/enforce sane max-connection values (fixes #1803)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2383 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-02-03 22:53:23 +00:00
Stefan Bühler 832ff277f2 Remove floating point math from server.c (fixes #1402)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2381 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-02-03 21:02:18 +00:00
Stefan Bühler 22d8707ef2 Use struct copy instead of memcpy for volatile siginfo_t in server.c
Fixes "discards qualifiers" warning.


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2292 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-08-19 22:23:34 +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
Elan Ruusamäe 5fa895e8ec - revert unwanted commit
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2193 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-07-14 14:33:06 +00:00
Elan Ruusamäe ef95813dea - merge spawn-fcgi changes from trunk (from @2191)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2192 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-07-14 14:26:20 +00:00
Stefan Bühler 93e7167f84 Implement a clean way to open /dev/null and use it to close stdin/out/err in the needed places (#624)
- as stderr gets redirected to /dev/null before exec in childs, we cannot
   write to the log afterwards, so disabled that log messages too.


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2163 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-04-29 20:59:39 +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 796502e7af r2087@chromobil: stefan | 2008-02-26 17:01:12 +0100
Fix #1562 and try re-fixing #372: out of range access in fd array
 
  - Bug is in original #372 fix [853]
  - The re-fix for #372 is not tested:
    the problem is that Solaris doesn't want to poll for maxfds (ulimit) events,
    as at least one filedescriptor is used for the poll device.
    So the solution is to just ask for one event less; the number of events
    actually available is returned by the poll syscall, so it should work.
 


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2082 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-02-26 16:20:04 +00:00
Elan Ruusamäe a18086bc35 - open log immediately after daemonizing, fixes SIGPIPEs on startup (#165)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2049 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-01-17 12:29:47 +00:00
Elan Ruusamäe 9ab9f176d2 - apply patches from #1384
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2020 152afb58-edef-0310-8abb-c4023f1b3aa9
2007-11-10 16:12:55 +00:00
Jan Kneschke e0629883a9 * fixed forwarding a SIGINT and SIGHUP when using max-workers (#902)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1982 152afb58-edef-0310-8abb-c4023f1b3aa9
2007-09-05 10:39:56 +00:00
Jan Kneschke 29fdd34abd fixed compile error on IRIX 6.5.x on prctl()
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1980 152afb58-edef-0310-8abb-c4023f1b3aa9
2007-09-02 19:48:47 +00:00
Jan Kneschke 1e1a8e5907 use HAVE_SYS_PRCTL_H as HAVE_PRCTL is not checked for
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1958 152afb58-edef-0310-8abb-c4023f1b3aa9
2007-08-21 23:35:08 +00:00
Jan Kneschke ef19bacae8 added sending UID and PID for SIGTERM and SIGINT to the logs
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1957 152afb58-edef-0310-8abb-c4023f1b3aa9
2007-08-21 17:40:03 +00:00