Commit Graph

276 Commits

Author SHA1 Message Date
Glenn Strauss 644725127f [core] connection_handle_errdoc() separate func 2020-07-08 18:08:52 -04:00
Glenn Strauss c193da3404 [core] split cond cache from cond matches 2020-07-08 18:08:52 -04:00
Glenn Strauss 5977ce2b4a [core] isolate use of data_config, configfile.h 2020-07-08 18:08:52 -04:00
Glenn Strauss ed62e354ff [core] use config_plugin_values_init() 2020-07-08 18:08:51 -04:00
Glenn Strauss 20450fd652 [core] mv config_setup_connection to connections.c
rename config_setup_connection() to connection_reset_config()
2020-05-23 17:59:29 -04:00
Glenn Strauss b2b41e36e3 [core] struct plugin_data_base 2020-05-23 17:59:29 -04:00
Glenn Strauss c022269547 [core] srv->plugin_slots as compact list 2020-05-23 17:59:29 -04:00
Glenn Strauss e2de4e581e [core] const char *name in struct plugin
put void *data (always used) as first member of struct plugin

add int nconfig member to PLUGIN_DATA

calloc() inits p->data to NULL
2020-05-23 17:59:29 -04:00
Glenn Strauss feb21b3da2 [core] inline header and env arrays into con 2020-05-23 17:59:29 -04:00
Glenn Strauss 6eb34ef5ab [core] add const to callers of http_header_*_get()
(The few places where value is modified in-place were not made const)
2020-02-24 11:15:32 -05:00
Glenn Strauss a7a721ab43 [core] treat con->conditional_is_valid as bitfield 2020-02-24 11:15:32 -05:00
Glenn Strauss e01f995ce3 [core] run config_setup_connection() fewer times
config_setup_connection() is run when con struct is init'd and in
connection_reset(), after each request is processed.  It also must be
called upon HANDLER_COMEBACK when the request needs to be re-parsed,
but it need not be run twice in common scenario without HANDLER_COMEBACK
2020-02-24 11:15:32 -05:00
Glenn Strauss 0ce30f8c22 [core] (const buffer *) for con->server_name
use con->server_name_buf when modules set server_name (e.g from db)
2020-02-24 11:15:32 -05:00
Glenn Strauss db5ff222e4 [core] short-circuit path to clear request.headers
short-circuit path to clear con->request.headers if entire size of
all request headers is <= BUFFER_MAX_REUSE_SIZE

clear (reset) data_string key and value upon reuse
2020-02-24 11:15:32 -05:00
Glenn Strauss 10d71279ae [core] uint32_t for struct buffer sizes 2020-02-24 11:15:32 -05:00
Glenn Strauss 62e97967ca [core] prefer uint32_t to size_t in base.h
even 2 billion is way larger than even extreme operating values
expected for the members in base.h

include some structs directly in struct server, rather than by ptr
2020-02-24 11:15:32 -05:00
Glenn Strauss 36f3206a4c [core] pass ptr to http_request_parse() 2020-02-24 11:15:32 -05:00
Glenn Strauss 8223903e50 [core] inline connection_read_header()
inline connection_read_header() into connection_handle_read_state()

(The large stack usage prevents the compiler from inlining the routine,
 but if we enter connection_handle_read_state(), then we are going to
 be running connection_read_header(), so put them together)
2020-02-24 11:15:32 -05:00
Glenn Strauss 11f3dd896b [core] perf: connection_read_header_hoff() hot 2020-02-24 11:15:32 -05:00
Glenn Strauss ec2ff2c6ae [core] perf: connection_read_header_more()
additional header parsing optimization
collect request headers into single buffer for parsing
2020-02-24 11:15:32 -05:00
Glenn Strauss 46d7e9c2ed [core] no need to pass srv to connection_set_state 2020-02-24 11:15:32 -05:00
Glenn Strauss 63e32e8100 [core] perf: HTTP header parsing using \n offsets 2020-02-24 11:15:32 -05:00
Glenn Strauss fcd1f57511 [core] connection_chunkqueue_compact() 2020-02-24 11:14:45 -05:00
Glenn Strauss c22ec74770 [core] do not pass srv to http header parsing func
srv is retrieved from con->srv in the few cases where needed
2020-02-24 11:14:45 -05:00
Glenn Strauss 80d12919d1 [core] replace connection_set_state w/ assignment
replace connection_set_state() with simple assignment

(only connections.c and connections-glue.c should change con state)
2020-02-24 11:14:45 -05:00
Glenn Strauss be6964f415 [core] use func rc to indicate done reading header 2020-02-24 11:14:45 -05:00
Glenn Strauss 1334436394 [core] store struct server * in struct connection 2020-02-24 11:14:45 -05:00
Glenn Strauss 670b2086f8 [core] move con state handling to connections*.c
move maint code from server.c to connections.c
2019-09-07 11:57:26 -04:00
Glenn Strauss 6572976e06 [core] chunkqueue perf: code reuse
code reuse, simplification, and inlining
remove excess calls to chunkqueue_remove_finished_chunks()

(it may still be possible for there to be an empty chunk in chunkqueue
 if nothing were written to a temporary file (need to verify this), so
 preserve some calls to chunkqueue_remove_finished_chunks() for now)
2019-05-13 20:27:49 -04:00
Glenn Strauss 003fd0f8c3 [core] store log_state_handling flag on stack 2019-05-07 20:14:50 -04:00
Glenn Strauss cbad7517c8 [core] struct log_error_st for error logging 2019-04-20 02:10:28 -04:00
Glenn Strauss 5440f04e8a [core] fix assertion with server.error-handler (fixes #2941)
(thx andpr)

x-ref:
  "failed assertion on incoming bad request when server.error-handler option is used"
  https://redmine.lighttpd.net/issues/2941
2019-03-13 00:48:26 -04:00
Glenn Strauss 9113011d5b [core] pass (fdnode *) for registered fdevent fd
inline fdevent_fdnode_interest()
avoid array lookup for (fdnode *) for various ops
2019-03-07 00:32:17 -05:00
Glenn Strauss 4e6e787a0d [core] remove redundant check for allow_http11
(conf.allow_http11 is handled in http_response_prepare())
2019-03-07 00:32:17 -05:00
Glenn Strauss 800e9b7349 [core] remove fde_ndx member outside fdevents
(isolated to fdevent framework internals)
2019-03-07 00:32:17 -05:00
Glenn Strauss 1542e44bb7 [core] use openssl to read,discard request body
use openssl to read,discard request body after response has been sent
on a TLS connection, at least until SSL close notify has been sent

x-ref:
  "HTTPS POST upload hangs when i reach maximum supported request size"
  https://redmine.lighttpd.net/boards/2/topics/8491
2019-03-07 00:32:14 -05:00
Glenn Strauss fca9e5a0b1 [core] prefer memchr() over strchr() 2019-02-17 19:51:12 -05:00
Glenn Strauss b1a9f335c6 [core] connection_handle_write() updates con state
(return value was always 0, so remove checks for other values)
2019-02-12 23:00:26 -05:00
Glenn Strauss 4713b6a61c [core] con->is_ssl_sock
flag to indicate if socket protocol is TLS
(future use: will be needed with connection upgrade to https; not impl)
2019-02-12 22:51:17 -05:00
Glenn Strauss 74b18c385c [core] no keep-alive if POLLRDHUP,empty read queue
send Connection: close if POLLRDHUP received and read queue is empty
2019-02-10 22:15:59 -05:00
Glenn Strauss daa5f7c576 [mod_accesslog] attempt to reconstruct req line
cease http_request_parse_reqline() unconditionally copying request line,
as request line is currently used only by mod_accesslog 'r' format
2019-02-10 03:10:11 -05:00
Glenn Strauss 950832af67 [core] RFC7230 HTTP-version parse 2019-02-10 02:57:09 -05:00
Glenn Strauss e5d61e9a5f [core] http_request_parse() mark error paths cold 2019-02-09 14:30:00 -05:00
Glenn Strauss 23b0d867c5 [core] replace con->response.keep_alive
set con->keep_alive = 0 to indicate backend request to close connection
2019-02-08 23:18:36 -05:00
Glenn Strauss 25185d1de0 [core] pass req hdrs buffer to http_request_parse 2019-02-08 22:49:46 -05:00
Glenn Strauss 7f8fd8ad09 [core] make parse_request,request.request same buf 2019-02-08 22:49:46 -05:00
Glenn Strauss d7ad5819e6 [core] copy request only if might need for logging
copy request header only if we may need to log it upon error
2019-02-08 22:49:46 -05:00
Glenn Strauss 9ab5469365 [core] parse request in connection_read_header() 2019-02-08 22:49:46 -05:00
Glenn Strauss 8426b94161 [core] perf: optimize connection_read_header() 2019-02-07 01:17:47 -05:00
Glenn Strauss 21afabb8f8 [core] helper funcs for connection_state_machine()
carve connection_state_machine() into separate functions per state
2019-02-04 21:50:53 -05:00