History log of /lighttpd1.4/src/http_cgi.c (Results 1 – 13 of 13)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 3a8fc4bc 26-Feb-2023 Glenn Strauss <[email protected]>

[multiple] store ptrs to remote addr in request_st (#3192)

adds two pointers to (request_st *) (cost: 16 bytes in 64-bit builds)

prepares for upcoming changes to mod_extforward to manage remote add

[multiple] store ptrs to remote addr in request_st (#3192)

adds two pointers to (request_st *) (cost: 16 bytes in 64-bit builds)

prepares for upcoming changes to mod_extforward to manage remote addr
per request for HTTP/2 requests, rather than remote addr per connection.

Modern load balancers often provide options to reuse connections for
*different* clients, and therefore mod_extforward might change the
remote addr per request.

x-ref:
"RFE: mod_extforward and multiplexed requests via HTTP/2"
https://redmine.lighttpd.net/issues/3192
"Evaluation of remote_addr for mod_maxminddb for multiplexed connections"
https://redmine.lighttpd.net/issues/3191

show more ...


Revision tags: lighttpd-1.4.69
# 93b0e85d 03-Feb-2023 Glenn Strauss <[email protected]>

[core] reset path-info for cgi.local-redir

cgi.local-redir occurs in the subrequest handler, by which point
path-info has been set. Since CGI local redir might restart the
request for an entirely d

[core] reset path-info for cgi.local-redir

cgi.local-redir occurs in the subrequest handler, by which point
path-info has been set. Since CGI local redir might restart the
request for an entirely different URL, reset the path info.

Note: mod_rewrite, mod_magnet, and others which may restart the request
do so prior to path-info being set.

path-info is always reset between different requests.

show more ...


Revision tags: lighttpd-1.4.68, lighttpd-1.4.67, lighttpd-1.4.66, lighttpd-1.4.65
# cc65a21e 18-Feb-2022 Glenn Strauss <[email protected]>

[mod_cgi] cgi.local-redir request_reset thru fnptr

cgi.local-redir call plugins_request_reset through fn ptr

(isolate plugins_* funcs to server;
should not be called directly from plugins/modules)


Revision tags: lighttpd-1.4.64, lighttpd-1.4.63, lighttpd-1.4.62, lighttpd-1.4.61, lighttpd-1.4.60
# 9fe8fbaa 20-Jun-2021 Glenn Strauss <[email protected]>

[multiple] http_method_buf()

- http_method_buf() returns (const buffer *)
- comment out unused get_http_status_name()
- inline func for http_append_method()

config processing requires a persistent

[multiple] http_method_buf()

- http_method_buf() returns (const buffer *)
- comment out unused get_http_status_name()
- inline func for http_append_method()

config processing requires a persistent buffer for method on the
off-chance that the config performed a capturing regex match in
$HTTP["method"] condition and used it later (e.g. in mod_rewrite)
(Prior behavior using r->tmp_buf was undefined in this case)

show more ...


# f1e8a82f 16-Jun-2021 Glenn Strauss <[email protected]>

[multiple] inline struct in con->dst_addr_buf

(mod_extforward recently changed to use buffer_move() to save addr
instead of swapping pointers)


# af3df29a 09-Jun-2021 Glenn Strauss <[email protected]>

[multiple] reduce redundant NULL buffer checks

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 co

[multiple] reduce redundant NULL buffer checks

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

show more ...


# 1553dc7b 24-May-2021 Glenn Strauss <[email protected]>

[core] reduce repeated work in http_cgi_headers()

save string lengths for reuse
remove trailing slash from strip_request_uri at config time


# a1eba3c8 27-Apr-2021 Glenn Strauss <[email protected]>

[core] reuse code to parse backend response

reuse code to parse backend response (http_header_parse_hoff())


# 680e6b3b 25-Mar-2021 Glenn Strauss <[email protected]>

[multiple] buffer_copy_path_len2() aggregate


# 9c8b9ff0 19-Mar-2021 Glenn Strauss <[email protected]>

[core] move special case for Content-Type CGI hdr

move special case for Content-Type CGI header to identify header with
tag rather than string comparison


# b9e1e93f 06-Mar-2021 Glenn Strauss <[email protected]>

[core] http_cgi_encode_varname()

move and rename from buffer.c to http_cgi.c:
buffer_copy_string_encoded_cgi_varnames() -> http_cgi_encode_varname()


# 5c2f5577 06-Mar-2021 Glenn Strauss <[email protected]>

[core] save parsed listen addrs at startup

save parsed listen addrs at startup for reuse at runtime

srv_socket->srv_token is normalized at startup and contains IP and port.
save offset to colon, if

[core] save parsed listen addrs at startup

save parsed listen addrs at startup for reuse at runtime

srv_socket->srv_token is normalized at startup and contains IP and port.
save offset to colon, if present, or else length of string (unix socket)

At runtime, srv_token_colon can be quickly used as length of IP string
(without port) or, if not length of string, offset of stringified port
following the colon.

show more ...


# c95f832f 05-Mar-2021 Glenn Strauss <[email protected]>

[core] http_cgi.[ch] CGI interfaces (RFC 3875)

collect Common Gateway Interface (CGI) interfaces (RFC 3875)