Commit Graph

4086 Commits (89c97b8cd8a4faf169965ec6383335d0c0a661ee)
 

Author SHA1 Message Date
Glenn Strauss c8820d2ecc [core] code reuse with array_match_value_prefix()
use array_match_value_prefix() when checking xdocroot
2 years ago
Glenn Strauss 1553dc7be8 [core] reduce repeated work in http_cgi_headers()
save string lengths for reuse
remove trailing slash from strip_request_uri at config time
2 years ago
Glenn Strauss 27b8f1d0b9 [core] compare entire "/bin/sh" "-c" after execve
compare entire "/bin/sh" "-c" strings after execve if execve fails
2 years ago
Glenn Strauss 4a246a8754 [TLS] write_cq_ssl defer remove_finished_chunks
not expecting 0-length chunks, but handle within loops as cold path

mark some cold paths in read_cq_ssl and write_cq_ssl callback funcs
2 years ago
Glenn Strauss 8b96169b68 [core] buffer_commit() optim; better asm 2 years ago
Glenn Strauss 6e6e8baae4 [core] connection_handle_read_state mark hot case
expect common case to receive completed set of headers
(e.g. from a TLS record or a non-TLS packet containing small header)
2 years ago
Glenn Strauss 01fdccd85a [core] network_write prefer writev() over write()
When writev() is available, always use writev() instead of write()
(Silently ignores config option to use write() if writev() is available)
(Still uses sendfile() instead of writev() when config selects sendfile)
2 years ago
Glenn Strauss c5dd8905e1 [core] network_write optimizations
more shared code, better asm
2 years ago
Glenn Strauss 41916b58de [core] return entry from array_insert_data_at_pos
(for convenience and to save a couple asm instructions)
2 years ago
Glenn Strauss cc8e710710 [core] make insert_dup an optional array method
make insert_dup an optional array method in data_methods
(currently used only for merging strings of type data_string)
2 years ago
Glenn Strauss 29b9735338 [mod_secdownload] include algo_hmac.c in mod
algo_hmac.c used only with mod_secdownload,
so include algo_hmac.c in mod_secdownload instead of lighttpd executable
2 years ago
Glenn Strauss 07aa7eedcc [core] comment out ck_getenv_s() (unused)
ck_getenv_s() not currently used in lighttpd;
lighttpd process env is stable
2 years ago
Glenn Strauss 0fd8918777 [mod_vhostdb*] rename http_vhostdb->mod_vhostdb_api
rename http_vhostdb.[ch] -> mod_vhostdb_api.[ch]
2 years ago
Glenn Strauss 3538f8f2a4 [mod_auth*] rename http_auth.* -> mod_auth_api.*
rename http_auth.[ch] -> mod_auth_api.[ch]
2 years ago
Glenn Strauss 1a8ac120b4 [mod_auth,mod_vhostdb] move helper funcs to mods
link http_auth.c into mod_auth
link http_vhostdb.c into mod_vhostdb
ensure that mod_auth loads before mod_authn_*
ensure that mod_vhostdb loads before mod_vhostdb_*
2 years ago
Glenn Strauss e110b062be [multiple] http_auth_digest_hex2bin -> li_hex2bin
move http_auth.c:http_auth_digest_hex2bin() to buffer.c:li_hex2bin()
for reuse, e.g. for use by mod_secdownload, which is not mod_auth*
2 years ago
Glenn Strauss 08c03cd450 [multiple] rename safe_memclear() -> ck_memzero() 2 years ago
Glenn Strauss 62ccda8592 [multiple] move const time cmp funcs to ck.[ch]
http_auth_const_time_memeq_pad() -> ck_memeq_const_time()
http_auth_const_time_memeq() -> ck_memeq_const_time_fixed_len()
2 years ago
Glenn Strauss 0286bdef0c [multiple] use thread-safe strerror where avail
use ck_strerror_s() to use strerror_s() or strerror_r() thread-safe and
constraint-checking interfaces, where available.
2 years ago
Glenn Strauss 86c39754f2 [core] ck.[ch] - C11 Annex K wrappers
(selected functions; not complete)

(import from one of my development branches from 2016)

define safe_memclear() -> ck_memzero() for transition
2 years ago
Glenn Strauss d4c1855578 [core] define __attribute_unused__ if needed 2 years ago
Glenn Strauss 4f8f83ea1d [core] move data_{array,integer,string} to array.c
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.
2 years ago
Glenn Strauss fbe55825b4 [core] consolidate config printing code
funcs use only at startup and only for lighttpd -p
2 years ago
Glenn Strauss 942c2f6722 [core] remove excess counts from print config
remove excess counts from print config
simplify double-quoted string printing
2 years ago
Glenn Strauss 0329e765a3 [core] remove size maint in algo_splaytree
remove size maintenance tracking in algo_splaytree; not used in lighttpd
2 years ago
Glenn Strauss f2aacad079 [core] load padding char from base64_table
(triggers preload-access of table)
2 years ago
Glenn Strauss 3301fe0455 [core] li_base64_dec() on 4 bytes at a time 2 years ago
Glenn Strauss 0dfe9f7b76 [core] merge base64 encoding to li_base64_enc()
single func with option to add padding or not
2 years ago
Glenn Strauss 235c0dca84 [core] base64 encode w/ reduced data dependencies 2 years ago
Glenn Strauss e7805dbf93 [core] base64 encode round-up for required space
no need for extra work for precision allocation to avoid 0-3 extra chars

note: callers passing precise buffer size for without padding will need
  to be modified to pass a slightly larger buffer, e.g. mod_secdownload
2 years ago
Glenn Strauss 30edc55bb3 [core] adjust some array code (better asm)
slightly reorganize some code for better asm
2 years ago
Glenn Strauss 6836a32c4f [core] omit fdevent select() code if poll() avail
omit fdevent select() code if poll() avail
translate server.event-handler = "select" to "poll" when poll available
2 years ago
Glenn Strauss 7b5ba32a12 [core] tighter OS event poll loops (better asm)
slightly reorganize some code for better asm
2 years ago
Glenn Strauss bac34c1a66 [tests] quite coverity warning in test_request.c 2 years ago
Glenn Strauss 80848d3708 [core] store int* ptr to common gw status counters
(avoid repeated table lookups)
2 years ago
Pavel Gulchuk 2d6c511d23 [core] fix kill workers and shutdown by signal
github: closes #105
2 years ago
Glenn Strauss 0532d67639 [core] document error edge case for HTTP/1.0
When lighttpd is not configured to stream the response body,
lighttpd sends partial content with an incorrect Content-Length
to an HTTP/1.0 client if a backend sends Transfer-Encoding: chunked
in response to lighttpd HTTP/1.1 request (to backend), and the response
from the backend ends up truncated.

lighttpd could instead send an HTTP/1.0 502 Bad Gateway, but the
current implementation chooses to send the partial content.  After all,
an HTTP/1.0 client is, well, HTTP/1.0, and so of limited intelligence.
2 years ago
Glenn Strauss 5ff9e2f6eb [core] remove some (now) unused http_chunk APIs
remove http_chunk_append_file() and http_chunk_append_file_range()

callers should choose to use stat_cache_entry_open() for caching
or should open file and check sizes and ranges
2 years ago
Glenn Strauss 1ce8220947 [core] range chk http_chunk_append_file_ref_range
add range sanity check in http_chunk_append_file_ref_range()
(before potentially sending HTTP/1.1 chunked header)
2 years ago
Glenn Strauss f0da8dd910 [mod_magnet] use http_chunk_append_file_ref_range 2 years ago
Glenn Strauss 1d9fe2a3d6 [mod_flv_streaming] check range before sending FLV
check range before sending FLV header
2 years ago
Glenn Strauss 2663bda37c [core] add option to read config file from stdin
add option to read config file from stdin using: -f -
(with "-" indicating to read config file from stdin)

This was already been possible using temporary files, unlinked and
passed to lighttpd as -f /proc/self/fd/XX (with XX as fd number)
on systems (or containers) in which /proc/self/fd/ is available

Note: using -f - is incompatible with one-shot mode (-1)
since one-shot mode expects stdin to be connected to the client
2 years ago
Glenn Strauss fd0cc46833 [core] remove HANDLER_UNSET enum value 2 years ago
Glenn Strauss bedfd8a78e [mod_*_dbi] fix sqlite3_dbdir spelling in comments
The sqlite3 option is "sqlite3_dbdir"
2 years ago
Glenn Strauss 302d82a59c [core] accept in network_server_handle_fdevent()
merge connection_accept() into network_server_handle_fdevent()

(possible since connection_accepted() was split out from
 connection_accept() a long time ago)
2 years ago
Glenn Strauss 924d3c9bd6 [multiple] mark con->srv_socket a const ptr 2 years ago
Glenn Strauss c964568e25 [core] remove redundant check for max_conns
network_server_handle_fdevent() checks max_conns and is the only
callers of connection_accept(), so connection_accept() does not
need to repeat the check.
2 years ago
Glenn Strauss 7b0bc1298a [core] reorder hook enum for better mem locality 2 years ago
Glenn Strauss 0afab29cfb [core] merge uri_raw and uri_clean hooks
hooks are run consecutively in http_response_prepare()

merge uri_raw before uri_clean to preserve existing ordering
2 years ago
Glenn Strauss 3a9a3716c4 [core] adjust r->http_host ptr caching
faster to use http_header_request_set_ptr() and buffer_copy_string_len()
than to use http_header_request_set() and http_header_request_get()

check r->http_host for NULL instead of relying on buffer_copy_* to do so
2 years ago