Commit Graph

41 Commits

Author SHA1 Message Date
Stefan Bühler 5c68caa6d7 [core] replace array weakref with vector
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3116 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-19 15:27:38 +00: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
Glenn Strauss 43da581893 [core] configparser: error on duplicate keys in array merge (fixes #2685)
From: Glenn Strauss <gstrauss@gluelogic.com>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3103 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-15 18:56:05 +00:00
Stefan Bühler 68e4a416cc [core] provide array_extract_element and use it
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3102 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-15 18:56:02 +00:00
Stefan Bühler e7a39cde36 [core] fix memory leak in configparser_merge_data
Release op1 memory on failure; fixes some theoretical memory leaks (a
failure results in early exit anyway).

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

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3101 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-15 18:41:59 +00:00
Stefan Bühler 8d8ae9cbc8 [core] improve array API to prevent theoretical memory leaks
- refactor insert into array_find_or_insert; if the element already
  exists the caller must resolve the conflict manually:
  - array_replace frees the old element
  - array_insert_unique calls "insert_dup"
  both have no return value anymore
- fix usages of array_replace; they now don't need to delete the old
  entry anymore; usage in configparser was probably broken, as it
  possibly deleted the old element before calling array_replace

This should fix a lot of the issues reported in "Fortify Open Review
Project - lighttpd 1.4.39" (usually hitting the array limit):
when the array size limit was hit "new" entries leaked instead of
getting added.

On 32-bit INT_MAX entries cannot actually be reached (each entry
requires at least 48 bytes, leading to a total of 96GB memory).

On 64-bit INT_MAX entries would require 224GB memory, so it would be
theoretically possible. But it would need 2^27 reallocations of two
C-arrays of up to 16GB size.

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

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3098 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-15 18:26:57 +00:00
Stefan Bühler 6c3c360129 [config] extend duplicate-array-key error (fixes #2704)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3085 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-02-23 17:05:10 +00:00
Stefan Bühler ad65603ec0 [core] fix conditional cache handling
- add new "skip" result to mark conditions that didn't actually get
  evaluated to false but just skipped because the preconditions failed.
- add "local_result" for each cache entry to remember whether the
  condition itself matched (not including the preconditions).
  this can be reused after a cache reset if the condition itself was not
  reset, but the preconditions were
- clear result of subtree (children and else-branches) when clearing a
  condition cache

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

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3082 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-02-21 18:32:14 +00:00
Stefan Bühler 431559e5df [configparser] don't continue after parse error (fixes #2717)
only use values in reduce actions when the config is still valid
(ctx->ok).

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

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3080 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-02-19 15:49:06 +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 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 0bd06a9629 Fix segfault on invalid config "duplicate else conditions" (fixes #2065)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2640 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-12 08:48:08 +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 543f8040d3 Print an error if you use too many captures in a regex pattern (fixes #2059)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2614 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-08-28 19:30:48 +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 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 e294fffbad Print helpful error message on conditionals in global block (#1550)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2277 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-08-01 20:31:43 +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
Jan Kneschke 7a61e46289 fixed warning about incompatible assignment
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2102 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-02-27 23:40:59 +00:00
Xuefer c97dc80862 fixed #1571: Crash when trying to add single item to list in config file
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2079 152afb58-edef-0310-8abb-c4023f1b3aa9
2008-02-25 06:57:32 +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
Marcus Rückert a3dcc8b505 - fixed crash with undefined environment variables
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1987 152afb58-edef-0310-8abb-c4023f1b3aa9
2007-09-06 21:19:25 +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
Jan Kneschke f56e3907fe merged [1078]
- allow empty arrays


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.11-ssl-fixes@1335 152afb58-edef-0310-8abb-c4023f1b3aa9
2006-09-23 07:15:07 +00:00
Jan Kneschke 3b73da83a2 merged [1217]
fixed allow-http-11


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.11-ssl-fixes@1282 152afb58-edef-0310-8abb-c4023f1b3aa9
2006-09-07 11:05:41 +00:00
Jan Kneschke a85ca5e0ef merged [1051], [1052], [1053], [1054], [1057], [1060], [1061], [1062]
added ssl.use-sslv2 and ssl.cipher-list


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.11-ssl-fixes@1279 152afb58-edef-0310-8abb-c4023f1b3aa9
2006-09-07 10:19:29 +00:00
Xuefer bf67fb1413 implement global context
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@956 152afb58-edef-0310-8abb-c4023f1b3aa9
2006-01-20 08:45:07 +00:00
Jan Kneschke ae4a4143d6 improved error-msg
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@894 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-12-20 14:02:03 +00:00
Jan Kneschke b4d9d061c8 either remove include config.h or covered it in HAVE_CONFIG_H
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@733 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-09-24 12:06:04 +00:00
Xuefer 5e2a796a19 fix for string to be key (implicit convert integer to string when needed).
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@731 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-09-22 13:45:33 +00:00
Xuefer 40fb6ffec1 correct error message for context_ndx
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@730 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-09-22 13:33:18 +00:00
Xuefer f387d89870 fix merging of auto-indexing element, and make autoload modules hack to use array merging
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@616 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-08-23 14:35:01 +00:00
Jan Kneschke 75c3a8393a added include_shell option to configfiles (merged the rest of the trunk changesets)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@530 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-08-09 06:42:33 +00:00
Jan Kneschke 360aba360f allow _ in env. and var. and optimized matching of conditions
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@529 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-08-08 17:25:55 +00:00
Jan Kneschke 6517c89d4a leak fixes
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@526 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-08-08 16:44:25 +00:00
Jan Kneschke d56f19c7d1 checked | to 'else' (merged [316])
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@524 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-08-08 16:34:49 +00:00
Jan Kneschke 6b85d74c2b fixed config eval (merged [315])
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@522 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-08-08 16:15:57 +00:00
Jan Kneschke 6e78c2c8df user defined variable, compute on parsing: string+string, int+int, array+array, var+=expression.
"include" sub configuration file. (merged ([308], [309], [306], [305])


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@520 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-08-08 14:40:47 +00:00
Jan Kneschke 8073d5fe9f added nested conditionals (merged [298])
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@519 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-08-08 13:48:33 +00:00
Jan Kneschke 4f14ff8424 merge [109], [259], [266] and [267]
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@277 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-04-14 21:20:29 +00:00
Jan Kneschke bcdc6a3bbc moved everything below trunk/ and added branches/ and tags/
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@30 152afb58-edef-0310-8abb-c4023f1b3aa9
2005-02-20 14:27:00 +00:00