summaryrefslogtreecommitdiff
path: root/src/configparser.y
Commit message (Collapse)AuthorAgeFilesLines
* [core] build configparser.y w/ -Werror workaroundsGlenn Strauss2023-01-131-1/+13
|
* [core] use data_config_list for configGlenn Strauss2022-12-101-3/+13
| | | | use data_config_list for config, replacing generated vector_config_weak
* [core] fix crash for invalid lighttpd.conf (fixes #3175)Glenn Strauss2022-11-231-1/+1
| | | | | | | | (thx dhjeong2) x-ref: "configuration parse bug" https://redmine.lighttpd.net/issues/3175
* [core] fix configparser_simplify_regex() commentGlenn Strauss2022-05-111-1/+1
|
* [core] sketch support for abstract socketsGlenn Strauss2022-05-071-1/+2
| | | | | | | | | | | | | | | | (experimental; untested) Note: abstract sockets do not require filesystem access and can not be protected using filesystem permissions; abstract sockets are accessible by any process in the same network namespace on the same machine. Abstract sockets can be passed to lighttpd via systemd socket activation mechanism, via xinetd, or any other process which creates an abstract socket and passes it to lighttpd. Abstract sockets can also be configured in lighttpd.conf using a backslash-escaped double-quoted string, where CTL and chars with high bit set are backslash-escaped into "\\xFF", with "\\x" followed by two-byte hex encoding (e.g. "FF") for each escaped char, e.g. "\\x00abstract-socket"
* [core] convert simple config cond regex to pre/sfxGlenn Strauss2022-04-081-2/+44
| | | | convert simple config condition regex to prefix/suffix match
* [core] tighten config parsing loopGlenn Strauss2022-04-081-18/+3
|
* [core] prefix (=^), suffix (=$) config conditions (fixes #3153)Glenn Strauss2022-04-081-2/+24
| | | | | | x-ref: "lighttpd.conf conditionals using prefix and suffix matching" https://redmine.lighttpd.net/issues/3153
* [multiple] remove buffer_init_buffer()Glenn Strauss2022-01-071-1/+1
| | | | | | | remove (minor) convenience func; easy to replace Like buffer_init_string(), buffer_init_buffer() was used in only a few places at startup or in cold funcs, so better off removed from buffer.c
* [multiple] remove buffer_init_string()Glenn Strauss2022-01-071-1/+1
| | | | remove (minor) convenience func; easy to replace
* [core] parse $HTTP["remote-ip"] CIDR mask at startGlenn Strauss2021-08-271-63/+4
| | | | | | | | | parse $HTTP["remote-ip"] CIDR mask into structured data at startup note: adds buffer_move() to configparser.y to reduce memory copying for all config values, and is required for remote-ip to preserve the structured data added after the config value string. (Alternatively, could have normalized the remote-ip value after copying into dc->string)
* [multiple] reduce redundant NULL buffer checksGlenn Strauss2021-08-271-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] move data_{array,integer,string} to array.cGlenn Strauss2021-05-201-7/+7
| | | | | | | | | | | 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] tolerate dup array config values if matchGlenn Strauss2021-05-061-3/+14
| | | | | tolerate duplicated array config values if identical key and value (still issue warning trace)
* [multiple] use buffer_append_* aggregatesGlenn Strauss2021-04-021-18/+22
| | | | reduces the number of round-trips into some frequently-called routines
* [core] defer pcre_compile until after config parseGlenn Strauss2021-03-221-17/+0
|
* [core] tighten struct data_config and related codeGlenn Strauss2021-01-291-189/+201
| | | | | | | 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()
* [core] fix (startup) mem leaks in configparser.yGlenn Strauss2020-10-241-2/+7
| | | | (thx stbuehler)
* [core] extend (data_string *) to store header idGlenn Strauss2020-10-111-0/+5
| | | | | | | | | | | | | | | | | | | | (optional addition to (data_string *), used by http_header.[ch]) extend (data_string *) instead of creating another data_* TYPE_* (new data type would probably have (data_string *) as base class) (might revisit choice in the future) HTTP_HEADER_UNSPECIFIED has been removed. It was used in select locations as an optimization to avoid looking up enum header_header_e before checking the array, but the ordering in the array now relies on having the id. Having the id allows for a quick check if a common header is present or not in the htags bitmask, before checking the array, and allows for integer comparison in the log(n) search of the array, instead of strncasecmp(). With HTTP_HEADER_UNSPECIFIED removed, add optimization to set bit in htags for HTTP_HEADER_OTHER when an "other" header is added, but do not clear the bit, as there might be addtl "other" headers
* [multiple] use *(unsigned char *) with ctypesGlenn Strauss2020-07-081-1/+1
|
* [multiple] split con, request (very large change)Glenn Strauss2020-07-081-1/+1
| | | | | | | | | | | | | | | | NB: r->tmp_buf == srv->tmp_buf (pointer is copied for quicker access) NB: request read and write chunkqueues currently point to connection chunkqueues; per-request and per-connection chunkqueues are not distinct from one another con->read_queue == r->read_queue con->write_queue == r->write_queue NB: in the future, a separate connection config may be needed for connection-level module hooks. Similarly, might need to have per-request chunkqueues separate from per-connection chunkqueues. Should probably also have a request_reset() which is distinct from connection_reset().
* [core] array_init() arg for initial sizeGlenn Strauss2020-07-081-2/+2
|
* [core] buffer string in data_configGlenn Strauss2020-02-241-3/+3
| | | | (instead of (buffer *))
* [core] const char *op in data_configGlenn Strauss2020-02-241-8/+8
| | | | (instead of (buffer *))
* [core] inline array as part of data_array valueGlenn Strauss2020-02-241-4/+3
| | | | (instead of value being (array *))
* [core] inline buffer as part of data_string valueGlenn Strauss2020-02-241-13/+8
| | | | (instead of value being (buffer *))
* [core] inline buffer as part of DATA_UNSET keyGlenn Strauss2020-02-241-30/+30
| | | | (instead of key being (buffer *))
* [core] differentiate array_get_* for ro and rwGlenn Strauss2020-02-241-7/+11
| | | | | | array_get_element_klen() is now intended for read-only access array_get_data_unset() is used by config processing for r/w access array_get_buf_ptr() is used for r/w access to ds->value (string buffer)
* [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] mark startup/shutdown funcs coldGlenn Strauss2019-02-041-1/+1
|
* [core] perf: simplify buffer_move()Glenn Strauss2018-11-251-2/+4
| | | | | | require src and dest to be non-NULL change no longer releases large swapped buffers with buffer_reset()
* [core] perf: simple, quick buffer_clear()Glenn Strauss2018-11-231-1/+1
| | | | | | | | | 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)
* [core] prefer buffer_append_string_len()Glenn Strauss2018-09-231-1/+1
| | | | | prefer buffer_append_string_len() when string len is known (instead of buffer_append_string() which will recalculate strlen)
* [core] more memory-efficient fn table for data_*Glenn Strauss2018-09-231-20/+20
| | | | | | 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-39/+4
| | | | 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] adjust parser for valid variable expansionGlenn Strauss2017-10-201-1/+3
| | | | | | | | | | | adjust config parser for valid variable expansion Return only the value when a variable is expanded so that the array element keeps its state as value-only or part of key-value (thx nicorac) x-ref: "https://redmine.lighttpd.net/boards/2/topics/7600"
* [core] optional condition in config "else" clause (fixes #1268)Glenn Strauss2017-05-151-0/+1
| | | | | | x-ref: "condition should be optional in "else" clause in configuration file" https://redmine.lighttpd.net/issues/1268
* [core] perf: skip redundant strlen() if len knownGlenn Strauss2017-05-151-9/+9
| | | | | | performance: skip redundant strlen() if length is already known introduce array_get_element_klen() to take key and klen params
* [core] configparser: fix resource handling in error cases (fixes #2809)Stefan Bühler2017-05-141-38/+50
| | | | | | | | | | | | | | | - lemon never calls the destructor for variables on the RHS, make sure to manually clean up - outside `if (ctx->ok) { }` always check for NULL pointers, i.e: - if (x) x->free(x) - buffer_free and array_free check for NULL on their own - cleanup RHS variables below `if (ctx->ok) { }` at the bottom - set variables to NULL before if ownership gets passed on - move some buffers instead of copying them x-ref: "Memory corruption in yy_reduce (configparser.y), SIGSEGV" https://redmine.lighttpd.net/issues/2809
* [core] omit default port from normalized host strGlenn Strauss2017-04-251-5/+5
| | | | omit default scheme port from normalized host string
* [core] remove some unused header includesGlenn Strauss2017-03-281-1/+0
| | | | remove exposure of stdio.h in buffer.h for print_backtrace(), now static
* [core] allow overriding prior config values (fixes #2799)Philip Prindeville2017-03-231-0/+17
| | | | | | | | | | | introduce ":=" config file syntax to replace previously set value github: closes #78 x-ref: "allow overriding configuration values" https://redmine.lighttpd.net/issues/2799 https://github.com/lighttpd/lighttpd1.4/pull/78
* [core] config match w/ arbitrary HTTP request hdrs (fixes #1556)Glenn Strauss2017-01-311-5/+19
| | | | | | x-ref: "Allow matching against any arbitrary HTTP header in the configuration file regexps" https://redmine.lighttpd.net/issues/1556
* [core] restrict where config "else" clauses occur (#1268)Glenn Strauss2016-10-091-9/+78
| | | | | | | | (improve validation) x-ref: "condition should be optional in "else" clause in configuration file" https://redmine.lighttpd.net/issues/1268
* [core] optional condition in config "else" clause (fixes #1268)Glenn Strauss2016-10-091-0/+22
| | | | | | x-ref: "condition should be optional in "else" clause in configuration file" https://redmine.lighttpd.net/issues/1268
* [core] $HTTP["remoteip"] must handle IPv6 w/o []Glenn Strauss2016-07-211-6/+41
| | | | | | | | | | | [core] $HTTP["remoteip"] must handle IPv6 w/o [] (existing behavior) This was inadvertently broken in lighttpd 1.4.40 when IP address normalization was added. In $HTTP["remoteip"], IPv6 is now accepted with or without '[]'. http_request_host_normalize() expects IPv6 with '[]', and config processing at runtime expects COMP_HTTP_REMOTE_IP compared without '[]', so '[]' is stripped (internally) after normalization
* use buffer_string_set_length() to truncate stringsGlenn Strauss2016-05-231-1/+1
|
* [config] normalize IP strings in lighttpd.confGlenn Strauss2016-05-191-1/+52
| | | | | normalize IP strings in lighttpd.conf conditionals: $SERVER["socket"], $HTTP["remoteip"], and $HTTP["host"]
* [configparser] fix small leak on config failureStefan Bühler2016-03-261-1/+5
| | | | | | From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3132 152afb58-edef-0310-8abb-c4023f1b3aa9