diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2020-09-11 17:25:43 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2020-10-11 12:19:26 -0400 |
commit | 2e0676fd6dbab9da6b838f8f803bfc5dec11b346 (patch) | |
tree | c5a0e1841c9fc71691a82e64b7b6f3d68b5ae60a /src/configparser.y | |
parent | 68ec5ad64226883182602d42eb9e2d4c100fed74 (diff) | |
download | lighttpd-git-2e0676fd6dbab9da6b838f8f803bfc5dec11b346.tar.gz |
[core] extend (data_string *) to store header id
(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
Diffstat (limited to 'src/configparser.y')
-rw-r--r-- | src/configparser.y | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/configparser.y b/src/configparser.y index eae39f88..a00e5554 100644 --- a/src/configparser.y +++ b/src/configparser.y @@ -8,6 +8,7 @@ #include "configfile.h" #include "buffer.h" #include "array.h" +#include "http_header.h" /* http_header_hkey_get() */ #include "request.h" /* http_request_host_normalize() */ #include <ctype.h> @@ -693,6 +694,10 @@ context ::= DOLLAR SRVVARNAME(B) LBRACKET stringop(C) RBRACKET cond(E) expressio } } + if (COMP_HTTP_REQUEST_HEADER == dc->comp) { + dc->ext = http_header_hkey_get(CONST_BUF_LEN(dc->comp_tag)); + } + buffer_copy_buffer(&dc->string, rvalue); if (ctx->ok) switch(E) { |