summaryrefslogtreecommitdiff
path: root/src/mod_status.c
Commit message (Collapse)AuthorAgeFilesLines
* [build] _WIN32 __declspec(dllexport) *_plugin_initGlenn Strauss2023-05-031-0/+1
| | | | _WIN32 __declspec(dllexport) on mod_*_plugin_init()
* [multiple] __MINGW32__ missing strftime() "%F %T"Glenn Strauss2023-05-031-0/+4
| | | | mingw does not support strftime() "%F %T"
* [core] hxcon "base class" for h2conGlenn Strauss2023-05-031-2/+1
|
* [core] r->x union w/ structs for r->x.{h1,h2}Glenn Strauss2023-04-291-1/+4
|
* [multiple] store ptrs to remote addr in request_st (#3192)Glenn Strauss2023-02-281-4/+4
| | | | | | | | | | | | | | | | | 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
* [multiple] quiet some coverity false positivesGlenn Strauss2023-01-131-3/+1
|
* [multiple] employ ck_calloc, ck_malloc shared codeGlenn Strauss2022-12-101-1/+1
| | | | | employ ck_calloc(), ck_malloc() shared code to slightly reduce code size (centralize the ck_assert() to check that memory allocation succeeded)
* [multiple] mark mod_*_plugin_init() funcs coldGlenn Strauss2022-12-071-0/+1
|
* [multiple] quiet coverity warnings using castsGlenn Strauss2022-09-151-1/+1
|
* [mod_status] display HTTP/2 control stream w/ reqsGlenn Strauss2022-05-111-3/+5
| | | | | | display HTTP/2 control stream as pseudo-request in request list HTTP/2 control stream has URI "*" from "PRI *" HTTP/2 connection preface
* [multiple] use buffer_append_char()Glenn Strauss2022-05-111-6/+6
|
* [core] reusable code for r->state stringsGlenn Strauss2022-05-111-55/+0
| | | | | | convenience macros/functions for display purposes (historical labels from mod_status are preserved for compatibility)
* [mod_status] reusable code for r->state stringsGlenn Strauss2022-05-101-84/+69
|
* [mod_status] fix counting of HTTP/2 bytes writtenGlenn Strauss2022-05-071-66/+54
| | | | | | remove usused accounting simplify to use (64-bit) off_t for counting, but preserve doubles for pretty-printing numbers with decimal point and size suffix
* [mod_status] con->h2 instead of r->http_versionGlenn Strauss2022-05-061-2/+2
| | | | | | | | | | check con->h2 instead of r->http_version (additional safeguard for #3152) x-ref: "Random Segfaults with version 1.4.64 w/ mod_sockproxy and ALPN h2" https://redmine.lighttpd.net/issues/3152
* [core] pcre2 support (--with-pcre2)Glenn Strauss2021-11-221-1/+1
| | | | | | x-ref: "lighttpd: depends on obsolete pcre3 library" https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000063
* [core] change srv->conns to doubly-linked-listGlenn Strauss2021-09-081-11/+4
| | | | avoids separate memory allocation for list of pointers
* [core] rename srv->max_conns -> srv->lim_connsGlenn Strauss2021-09-081-6/+6
| | | | | | | | srv->lim_conns tracks remaining conns until limit is reached, replacing (srv->max_conns - srv->conns.used) srv->srvconf.max_conns is now updated at startup, so srv->srvconf.max_conns serves as srv->max_conns
* [multiple] Y2038 32-bit signed time_t mitigationsGlenn Strauss2021-09-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most OS platforms have already provided solutions to Y2038 32-bit signed time_t 5 - 10 years ago (or more!) Notable exceptions are Linux i686 and FreeBSD i386. Since 32-bit systems tend to be embedded systems, and since many distros take years to pick up new software, this commit aims to provide Y2038 mitigations for lighttpd running on 32-bit systems with Y2038-unsafe 32-bit signed time_t * Y2038: lighttpd 1.4.60 and later report Y2038 safety $ lighttpd -V + Y2038 support # Y2038-SAFE $ lighttpd -V - Y2038 support (unsafe 32-bit signed time_t) # Y2038-UNSAFE * Y2038: general platform info * Y2038-SAFE: lighttpd 64-bit builds on platforms using 64-bit time_t - all major 64-bit platforms (known to this author) use 64-bit time_t * Y2038-SAFE: lighttpd 32-bit builds on platforms using 64-bit time_t - Linux x32 ABI (different from i686) - FreeBSD all 32-bit and 64-bit architectures *except* 32-bit i386 - NetBSD 6.0 (released Oct 2012) all 32-bit and 64-bit architectures - OpenBSD 5.5 (released May 2014) all 32-bit and 64-bit architectures - Microsoft Windows XP and Visual Studio 2005 (? unsure ?) Another reference suggests Visual Studio 2015 defaults to 64-bit time_t - MacOS 10.15 Catalina (released 2019) drops support for 32-bit apps * Y2038-SAFE: lighttpd 32-bit builds on platforms using 32-bit unsigned time_t - e.g. OpenVMS (unknown if lighttpd builds on this platform) * Y2038-UNSAFE: lighttpd 32-bit builds on platforms using 32-bit signed time_t - Linux 32-bit (including i686) - glibc 32-bit library support not yet available for 64-bit time_t - https://sourceware.org/glibc/wiki/Y2038ProofnessDesign - Linux kernel 5.6 on 32-bit platforms does support 64-bit time_t https://itsubuntu.com/linux-kernel-5-6-to-fix-the-year-2038-issue-unix-y2k/ - https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html "Note: at this point, 64-bit time support in dual-time configurations is work-in-progress, so for these configurations, the public API only makes the 32-bit time support available. In a later change, the public API will allow user code to choose the time size for a given compilation unit." - compiling with -D_TIME_BITS=64 currently has no effect - glibc recent (Jul 2021) mailing list discussion - https://public-inbox.org/bug-gnulib/878s2ozq70.fsf@oldenburg.str.redhat.com/T/ - FreeBSD i386 - DragonFlyBSD 32-bit * Y2038 mitigations attempted on Y2038-UNSAFE platforms (32-bit signed time_t) * lighttpd prefers system monotonic clock instead of realtime clock in places where realtime clock is not required * lighttpd treats negative time_t values as after 19 Jan 2038 03:14:07 GMT * (lighttpd presumes that lighttpd will not encounter dates before 1970 during normal operation.) * lighttpd casts struct stat st.st_mtime (and st.st_*time) through uint64_t to convert negative timestamps for comparisions with 64-bit timestamps (treating negative timestamp values as after 19 Jan 2038 03:14:07 GMT) * lighttpd provides unix_time64_t (int64_t) and * lighttpd provides struct unix_timespec64 (unix_timespec64_t) (struct timespec equivalent using unix_time64_t tv_sec member) * lighttpd provides gmtime64_r() and localtime64_r() wrappers for platforms 32-bit platforms using 32-bit time_t and lighttpd temporarily shifts the year in order to use gmtime_r() and localtime_r() (or gmtime() and localtime()) from standard libraries, before readjusting year and passing struct tm to formatting functions such as strftime() * lighttpd provides TIME64_CAST() macro to cast signed 32-bit time_t to unsigned 32-bit and then to unix_time64_t * Note: while lighttpd tries handle times past 19 Jan 2038 03:14:07 GMT on 32-bit platforms using 32-bit signed time_t, underlying libraries and underlying filesystems might not behave properly after 32-bit signed time_t overflows (19 Jan 2038 03:14:08 GMT). If a given 32-bit OS does not work properly using negative time_t values, then lighttpd likely will not work properly on that system. * Other references and blogs - https://en.wikipedia.org/wiki/Year_2038_problem - https://en.wikipedia.org/wiki/Time_formatting_and_storage_bugs - http://www.lieberbiber.de/2017/03/14/a-look-at-the-year-20362038-problems-and-time-proofness-in-various-systems/
* [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/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [multiple] use buffer_append_* aggregatesGlenn Strauss2021-04-021-221/+167
| | | | reduces the number of round-trips into some frequently-called routines
* [mod_status] double-buffer large output to tmpfileGlenn Strauss2021-04-021-33/+48
|
* [multiple] strftime %F and %TGlenn Strauss2021-04-021-1/+1
| | | | strftime %F for %Y-%m-%d, and %T for %H:%M:%S
* [multiple] employ http_date.h, sys-time.hGlenn Strauss2020-12-241-3/+3
| | | | | - replace use of strptime() w/ implementation specialized for HTTP dates - use thread-safe gmtime_r(), localtime_r() (replace localtime, gmtime)
* [mod_status] add additional HTML-encodingGlenn Strauss2020-11-271-5/+5
|
* [multiple] inline chunkqueue where always alloc'dGlenn Strauss2020-10-111-13/+13
| | | | | | inline struct chunkqueue where always allocated in other structs (memory locality)
* [core] reuse r->start_hp.tv_sec for r->start_tsGlenn Strauss2020-10-111-1/+1
| | | | (remove duplicated field from (request_st *))
* [mod_status] dedicated funcs for r->state labelsGlenn Strauss2020-10-111-6/+45
| | | | | | | | | | fork connection_get_state() for use by mod_status, which might in the future choose to display different labels. move and rename connection_get_short_state() into mod_status, as the func is used only by mod_status (connection_get_state() is currently used elsewhere only for debugging in connections.c)
* [mod_status] adjust to print HTTP/2 requestsGlenn Strauss2020-10-111-3/+14
|
* [mod_status] separate funcs to print request tableGlenn Strauss2020-10-111-85/+89
|
* [multiple] split con, request (very large change)Glenn Strauss2020-07-081-80/+83
| | | | | | | | | | | | | | | | NB: r->tmp_buf == srv->tmp_buf (pointer is copied for quicker access) NB: request read and write chunkqueues currently point to connection chunkqueues; per-request and per-connection chunkqueues are not distinct from one another con->read_queue == r->read_queue con->write_queue == r->write_queue NB: in the future, a separate connection config may be needed for connection-level module hooks. Similarly, might need to have per-request chunkqueues separate from per-connection chunkqueues. Should probably also have a request_reset() which is distinct from connection_reset().
* [multiple] copy small struct instead of memcpy()Glenn Strauss2020-07-081-1/+2
| | | | when patching config
* [core] store subrequest_handler instead of modeGlenn Strauss2020-07-081-1/+1
| | | | store pointer to module in handler_module instead of con->mode id
* [core] move request state into (request_st *)Glenn Strauss2020-07-081-7/+7
| | | | | NB: in the future, a separate connection state may be needed for connection-level state (different from request state)
* [core] move addtl request-specific struct membersGlenn Strauss2020-07-081-8/+8
|
* [core] move addtl request-specific struct membersGlenn Strauss2020-07-081-5/+5
|
* [core] move request start ts into (request_st *)Glenn Strauss2020-07-081-1/+1
| | | | move request start timestamps into (request_st *)
* [core] rename content_length to reqbody_lengthGlenn Strauss2020-07-081-2/+2
| | | | | | rename content_length to reqbody_length in request, to more easily differentiate request body length from response content_length
* [multiple] extern log_epoch_secsGlenn Strauss2020-07-081-3/+3
| | | | replace srv->cur_ts
* [multiple] reduce direct use of srv->cur_tsGlenn Strauss2020-07-081-10/+7
|
* [multiple] plugin_stats arrayGlenn Strauss2020-07-081-1/+1
| | | | | | | use global rather than passing around (server *) just for that li_itostrn() and li_utostrn() return string length (rather than requiring subsequent strlen() to find length)
* [multiple] connection hooks no longer get (srv *)Glenn Strauss2020-07-081-11/+10
| | | | (explicit (server *) not passed; available in con->srv)
* [multiple] prefer (connection *) to (srv *)Glenn Strauss2020-07-081-1/+0
| | | | | | | | convert all log_error_write() to log_error() and pass (log_error_st *) use con->errh in preference to srv->errh (even though currently same) avoid passing (server *) when previously used only for logging (errh)
* [core] array_init() arg for initial sizeGlenn Strauss2020-07-081-1/+1
|
* [multiple] plugin.c handles common FREE_FUNC codeGlenn Strauss2020-07-081-12/+0
| | | | (simpler for modules; less boilerplate to cut-n-paste)
* [core] use config_plugin_values_init()Glenn Strauss2020-07-081-1/+1
|
* [mod_status] use config_plugin_values_init()Glenn Strauss2020-05-231-154/+100
|
* [core] const char *name in struct pluginGlenn Strauss2020-05-231-11/+5
| | | | | | | | put void *data (always used) as first member of struct plugin add int nconfig member to PLUGIN_DATA calloc() inits p->data to NULL
* [core] simpler config_check_cond()Glenn Strauss2020-05-231-3/+2
| | | | | | | optimize for common case where condition has been evaluated for the request and a cached result exists (also: begin isolating data_config)