summaryrefslogtreecommitdiff
path: root/src/data_config.c
Commit message (Collapse)AuthorAgeFilesLines
* [multiple] employ ck_calloc, ck_malloc shared codeGlenn Strauss2022-12-101-4/+1
| | | | | employ ck_calloc(), ck_malloc() shared code to slightly reduce code size (centralize the ck_assert() to check that memory allocation succeeded)
* [core] use data_config_list for configGlenn Strauss2022-12-101-2/+1
| | | | use data_config_list for config, replacing generated vector_config_weak
* [array] use speaking names for array "fn" vtables for better debugging ↵Stefan Bühler2022-01-061-2/+2
| | | | experience
* [core] ignore pcre2 "bad JIT option" warningGlenn Strauss2021-12-151-1/+1
| | | | | | | | | ignore pcre2 bad JIT option warning for use of PCRE2_JIT_COMPLETE flag with pcre2_jit_compile() returning PCRE2_ERROR_JIT_BADOPTION x-ref: "pcre2 - Probable user knowledge bug, but suggestions will be welcome" https://redmine.lighttpd.net/boards/2/topics/10202
* [core] allocate pcre output vector on demandGlenn Strauss2021-11-221-0/+1
| | | | | allocate pcre output vector on demand for saved config captures (similar to what is done in lighttpd for pcre2 support)
* [core] pcre2 support (--with-pcre2)Glenn Strauss2021-11-221-6/+68
| | | | | | x-ref: "lighttpd: depends on obsolete pcre3 library" https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000063
* [multiple] reduce redundant NULL buffer checksGlenn Strauss2021-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is a large set of code changes and results in removal of hundreds, perhaps thousands, of CPU instructions, a portion of which are on hot code paths. Most (buffer *) used by lighttpd are not NULL, especially since buffers were inlined into numerous larger structs such as request_st and chunk. In the small number of instances where that is not the case, a NULL check is often performed earlier in a function where that buffer is later used with a buffer_* func. In the handful of cases that remained, a NULL check was added, e.g. with r->http_host and r->conf.server_tag. - check for empty strings at config time and set value to NULL if blank string will be ignored at runtime; at runtime, simple pointer check for NULL can be used to check for a value that has been set and is not blank ("") - use buffer_is_blank() instead of buffer_string_is_empty(), and use buffer_is_unset() instead of buffer_is_empty(), where buffer is known not to be NULL so that NULL check can be skipped - use buffer_clen() instead of buffer_string_length() when buffer is known not to be NULL (to avoid NULL check at runtime) - use buffer_truncate() instead of buffer_string_set_length() to truncate string, and use buffer_extend() to extend Examples where buffer known not to be NULL: - cpv->v.b from config_plugin_values_init is not NULL if T_CONFIG_BOOL (though we might set it to NULL if buffer_is_blank(cpv->v.b)) - address of buffer is arg (&foo) (compiler optimizer detects this in most, but not all, cases) - buffer is checked for NULL earlier in func - buffer is accessed in same scope without a NULL check (e.g. b->ptr) internal behavior change: callers must not pass a NULL buffer to some funcs. - buffer_init_buffer() requires non-null args - buffer_copy_buffer() requires non-null args - buffer_append_string_buffer() requires non-null args - buffer_string_space() requires non-null arg
* [core] make insert_dup an optional array methodGlenn Strauss2021-08-271-7/+1
| | | | | make insert_dup an optional array method in data_methods (currently used only for merging strings of type data_string)
* [core] move data_{array,integer,string} to array.cGlenn Strauss2021-05-201-4/+1
| | | | | | | | | | | move native data_* types into array.c (the types are already declared in array.h) The array data structure remains extendable, as is done with data_config (configfile) and data_auth (mod_auth), though array data structure primary uses are at startup (config time) and header parsing. The insertion logic into sorted list can be expensive for large lists, so header parsing might choose a different data structure in the future.
* [core] consolidate config printing codeGlenn Strauss2021-05-201-71/+0
| | | | funcs use only at startup and only for lighttpd -p
* [multiple] PCRE w/ PCRE_STUDY_JIT_COMPILE (fixes #2361)Glenn Strauss2021-03-221-19/+29
| | | | | | | | | | | | | | | | | | | | | | | | | enabled by default disable using server.feature-flags += ("server.pcre_jit" => "disable") Available since pcre-8.20 (2011), and improved in pcre-8.32 (2012), PCRE_STUDY_JIT_COMPILE can greatly speed up repeated execution of PCRE patterns. (https://zherczeg.github.io/sljit/pcre.html) lighttpd continues to use pcre_exec() instead of pcre_jit_exec(), even though doing so does not realize all of the performance increase potentially available with PCRE_STUDY_JIT_COMPILE and pcre_jit_exec(). pcre_jit_exec() is available with PCRE 8.32 and later, if PCRE is compiled with --enable-jit, but lighttpd does not currently use pcre_jit_exec() since the PCRE library might not have been compiled with --enable-jit (though this could be solved with a weak symbol). Similarly, lighttpd does not currently configure the pcre_jit_stack. (Using pcre_jit_exec() may be revisited in the future.) x-ref: "add support for pcre JIT" https://redmine.lighttpd.net/issues/2361
* [core] tighten struct data_config and related codeGlenn Strauss2021-01-291-13/+11
| | | | | | | tighten struct data_config and config_cond_info create config key at startup and reuse for debug/trace separate routine for configparser_parse_condition() separate routine for configparser_parse_else_condition()
* quiet clang analyzer scan-build warningsGlenn Strauss2020-07-081-0/+1
| | | | | | | | | | (expansion of buffer_string_lenth() inline function and CONST_BUF_LEN() macro, which always check for NULL, appears to cause the analyzer to believe that a pointer might be NULL in cases where it otherwise can not be NULL) x-ref: http://clang-analyzer.llvm.org/faq.html
* [core] array_init() arg for initial sizeGlenn Strauss2020-07-081-1/+1
|
* [core] buffer string in data_configGlenn Strauss2020-02-241-8/+8
| | | | (instead of (buffer *))
* [core] const char *op in data_configGlenn Strauss2020-02-241-4/+2
| | | | (instead of (buffer *))
* [core] inline array as part of data_array valueGlenn Strauss2020-02-241-2/+1
| | | | (instead of value being (array *))
* [core] inline buffer as part of DATA_UNSET keyGlenn Strauss2020-02-241-5/+4
| | | | (instead of key being (buffer *))
* [core] isolate data_config.c, vector.cGlenn Strauss2020-02-241-20/+0
| | | | isolate data_config.c, vector.c to lighttpd executable, not modules
* [core] remove unused array_reset()Glenn Strauss2020-02-241-12/+0
|
* [core] mark some data_* funcs coldGlenn Strauss2020-02-241-0/+5
| | | | | | | | | | | | | mark funcs cold if seldom used or used only at startup config processing mark most data_config_* funcs cold data_*_copy() data_*_insert_dup() data_*_print() data_*_reset() array_reset()
* [core] perf: array.c performance enhancementsGlenn Strauss2020-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | mark array_get_index() as hot, rewrite to be pure and return sorted pos mark routines as pure, as appropriate mark routines as cold if used only at startup for config processing mark params const, as appropriate array_get_buf_ptr() for modifiable value buffer after insert into array uint32_t used and size members instead of size_t remove a->unique_ndx member; simply add to end of array for value lists remove du->is_index_key member; simply check buffer_is_empty(du->key) array_insert_key_value() used to be a hint that lookup could be skipped, but the state from array_get_index() is now saved and reused internally, so the distinction is no longer needed. Use array_set_key_value().
* [core] perf: simple, quick buffer_clear()Glenn Strauss2018-11-231-3/+3
| | | | | | | | | quickly clear buffer instead of buffer_string_set_length(b, 0) or buffer_reset(b). Avoids free() of large buffers about to be reused, or buffers that are module-scoped, persistent, and reused. (buffer_reset() should still be used with buffers in connection *con when the data in the buffers is supplied by external, untrusted source)
* [multiple] quiet compiler warnings --without-pcreGlenn Strauss2018-09-251-0/+3
| | | | quiet compiler warnings for ./configure --without-pcre
* [core] more memory-efficient fn table for data_*Glenn Strauss2018-09-231-9/+12
| | | | | | save 40 bytes (64-bit), or 16 bytes (32-bit) per data_* element at the cost of going through indirect function pointer to execute methods. At runtime, the reset() method is most used among them.
* [core] data_config_pcre_compile,exec()Glenn Strauss2018-08-051-0/+60
| | | | collect PCRE usage related to config processing
* [core] some header cleanupGlenn Strauss2018-04-081-0/+5
| | | | | | | | | provide standard types in first.h instead of base.h provide lighttpd types in base_decls.h instead of settings.h reduce headers exposed by headers for core data structures do not expose <pcre.h> or <stdlib.h> in headers move stat_cache_entry to stat_cache.h reduce use of "server.h" and "base.h" in headers
* [core] perf: skip redundant strlen() if len knownGlenn Strauss2017-05-151-1/+1
| | | | | | performance: skip redundant strlen() if length is already known introduce array_get_element_klen() to take key and klen params
* [core] config match w/ arbitrary HTTP request hdrs (fixes #1556)Glenn Strauss2017-01-311-0/+5
| | | | | | x-ref: "Allow matching against any arbitrary HTTP header in the configuration file regexps" https://redmine.lighttpd.net/issues/1556
* [core] optional condition in config "else" clause (fixes #1268)Glenn Strauss2016-10-091-4/+12
| | | | | | x-ref: "condition should be optional in "else" clause in configuration file" https://redmine.lighttpd.net/issues/1268
* [core] replace array weakref with vectorStefan Bühler2016-03-191-15/+12
| | | | | | 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
* consistent inclusion of config.h at top of files (fixes #2073)Glenn Strauss2016-03-191-0/+2
| | | | | | 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
* [core] fix conditional cache handlingStefan Bühler2016-02-211-6/+6
| | | | | | | | | | | | | | | - 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
* fix buffer, chunk and http_chunk APIStefan Bühler2015-02-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Fix header inclusion order, always include "config.h" before any system headerStefan Bühler2009-10-111-2/+2
| | | | git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2624 152afb58-edef-0310-8abb-c4023f1b3aa9
* - white space cleanup part 2 this time 1.4 ;)Marcus Rückert2006-10-041-12/+12
| | | | | | 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
* print 'lighttpd -p -f ...' to stdout instead of stderrJan Kneschke2006-09-201-14/+14
| | | | git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.11-ssl-fixes@1318 152afb58-edef-0310-8abb-c4023f1b3aa9
* make output of array/config same format as lighttpd.conf, with auto indentionmOo2005-08-171-8/+29
| | | | git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@554 152afb58-edef-0310-8abb-c4023f1b3aa9
* added include_shell option to configfiles (merged the rest of the trunk ↵Jan Kneschke2005-08-091-4/+7
| | | | | | changesets) git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@530 152afb58-edef-0310-8abb-c4023f1b3aa9
* added weak-ref and nicer print() (merged [332], [336])Jan Kneschke2005-08-081-3/+37
| | | | git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@528 152afb58-edef-0310-8abb-c4023f1b3aa9
* leak fixesJan Kneschke2005-08-081-2/+3
| | | | git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@526 152afb58-edef-0310-8abb-c4023f1b3aa9
* const 1st arg for copy/print (merged [314])Jan Kneschke2005-08-081-2/+2
| | | | git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@525 152afb58-edef-0310-8abb-c4023f1b3aa9
* user defined variable, compute on parsing: string+string, int+int, ↵Jan Kneschke2005-08-081-0/+11
| | | | | | | | | 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
* added nested conditionals (merged [298])Jan Kneschke2005-08-081-6/+3
| | | | git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@519 152afb58-edef-0310-8abb-c4023f1b3aa9
* indent array for readability (merged [288])Jan Kneschke2005-08-081-4/+6
| | | | git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@508 152afb58-edef-0310-8abb-c4023f1b3aa9
* moved everything below trunk/ and added branches/ and tags/Jan Kneschke2005-02-201-0/+69
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@30 152afb58-edef-0310-8abb-c4023f1b3aa9