summaryrefslogtreecommitdiff
path: root/src/http_cgi.c
Commit message (Collapse)AuthorAgeFilesLines
* [core] rename http_kv funcs, reorder http_versionsGlenn Strauss2023-05-031-3/+2
| | | | | rename http_kv funcs for consistency ("http_" prefix) reorder http_versions[]
* [multiple] store ptrs to remote addr in request_st (#3192)Glenn Strauss2023-02-281-2/+2
| | | | | | | | | | | | | | | | | 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
* [core] reset path-info for cgi.local-redirGlenn Strauss2023-02-041-0/+1
| | | | | | | | | | | 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.
* [mod_cgi] cgi.local-redir request_reset thru fnptrGlenn Strauss2022-02-191-1/+1
| | | | | | | cgi.local-redir call plugins_request_reset through fn ptr (isolate plugins_* funcs to server; should not be called directly from plugins/modules)
* [multiple] http_method_buf()Glenn Strauss2021-08-271-3/+2
| | | | | | | | | | | - 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)
* [multiple] inline struct in con->dst_addr_bufGlenn Strauss2021-08-271-1/+1
| | | | | (mod_extforward recently changed to use buffer_move() to save addr instead of swapping pointers)
* [multiple] reduce redundant NULL buffer checksGlenn Strauss2021-08-271-37/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] reduce repeated work in http_cgi_headers()Glenn Strauss2021-08-271-36/+18
| | | | | save string lengths for reuse remove trailing slash from strip_request_uri at config time
* [core] reuse code to parse backend responseGlenn Strauss2021-04-271-1/+0
| | | | reuse code to parse backend response (http_header_parse_hoff())
* [multiple] buffer_copy_path_len2() aggregateGlenn Strauss2021-04-021-9/+9
|
* [core] move special case for Content-Type CGI hdrGlenn Strauss2021-03-261-1/+6
| | | | | move special case for Content-Type CGI header to identify header with tag rather than string comparison
* [core] http_cgi_encode_varname()Glenn Strauss2021-03-071-4/+25
| | | | | move and rename from buffer.c to http_cgi.c: buffer_copy_string_encoded_cgi_varnames() -> http_cgi_encode_varname()
* [core] save parsed listen addrs at startupGlenn Strauss2021-03-071-36/+46
| | | | | | | | | | | 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.
* [core] http_cgi.[ch] CGI interfaces (RFC 3875)Glenn Strauss2021-03-071-0/+321
collect Common Gateway Interface (CGI) interfaces (RFC 3875)