summaryrefslogtreecommitdiff
path: root/src/mod_magnet_cache.c
Commit message (Collapse)AuthorAgeFilesLines
* [multiple] employ ck_calloc, ck_malloc shared codeGlenn Strauss2022-12-101-8/+3
| | | | | employ ck_calloc(), ck_malloc() shared code to slightly reduce code size (centralize the ck_assert() to check that memory allocation succeeded)
* [multiple] employ ck_realloc_u32() shared codeGlenn Strauss2022-12-101-5/+2
| | | | employ ck_realloc_u32() shared code to slightly reduce code size
* [mod_magnet] clear stack when reloading scriptGlenn Strauss2022-02-191-4/+4
|
* [mod_magnet] defer req_env init unless neededGlenn Strauss2022-02-191-3/+8
| | | | defer req_env initialization unless req_env might be needed by script
* [multiple] __attribute_nonnull__ now takes paramsGlenn Strauss2021-10-051-1/+1
| | | | | | | | | define __attribute_nonnull__(params) with params to match recent changes in glibc development (targetting glibc 2.35 in Feb 2022) x-ref: new __attribute_nonnull__(params) conflicts with third-party https://sourceware.org/bugzilla/show_bug.cgi?id=28425
* [multiple] quiet coverity warningsGlenn Strauss2021-09-091-0/+1
|
* [mod_magnet] reuse lighty lua tableGlenn Strauss2021-09-081-6/+4
| | | | | reuse lighty lua table; leave on stack reset response tables lighty.header[] and lighty.content[] each request
* [core] quiet compiler warningsGlenn Strauss2021-09-041-0/+1
| | | | | | | | | | cast away signedness warning in request_check_hostname() mod_gnutls https_add_ssl_client_entries crts allocated if crt_size != 0 (which is already checked earlier in routine) report from FaceBook Infer static analysis tool (https://fbinfer.com/) - quiet dead store warnings - check return != NULL from allocation funcs
* [mod_magnet] cache script objects at config timeGlenn Strauss2021-08-271-13/+15
| | | | always check at least mtime and size to trigger script reload
* [mod_magnet] sync script load w/ stat_cacheGlenn Strauss2021-08-271-64/+97
| | | | | | | read file and use luaL_loadbuffer() eliminate TOC-TOU race w/ independent stat() in stat_cache_get_entry() restructure script_cache_get_script() into smaller funcs
* [mod_magnet] inline name and etag buffers in cacheGlenn Strauss2021-08-271-44/+35
| | | | also mark cache init and cache free funcs as cold
* [multiple] reduce redundant NULL buffer checksGlenn Strauss2021-08-271-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] consistent inclusion of sys-time.hGlenn Strauss2021-04-281-1/+1
|
* [multiple] mark addtl funcs attr returns_nonnullGlenn Strauss2021-03-261-0/+1
|
* [multiple] prefer monotonic time for internal useGlenn Strauss2021-03-111-4/+0
| | | | | | | | Note: monotonic time does not change while VM is suspended Continue to use real time where required by HTTP protocol, for logging and for other user-visible instances, such as mod_status, as well as for external databases and caches.
* [multiple] stat_cache singletonGlenn Strauss2020-07-081-15/+13
|
* [multiple] connection hooks no longer get (srv *)Glenn Strauss2020-07-081-3/+3
| | | | (explicit (server *) not passed; available in con->srv)
* [core] use config_plugin_values_init()Glenn Strauss2020-07-081-2/+2
|
* [mod_magnet] use config_plugin_values_init()Glenn Strauss2020-05-231-7/+5
|
* [multiple] reduce code dup in list resizingGlenn Strauss2019-02-121-4/+1
| | | | | | | | | reduce code duplication in list resizing realloc() of NULL ptr has behavior similar to malloc() Note that if initial size == 0, then code used to adjust size must be += x to ensure the size is non-zero for reallocation. (Multiplying 0 * x, e.g. power-2 resizing, will result in 0.)
* [core] some header cleanupGlenn Strauss2018-04-081-0/+1
| | | | | | | | | provide standard types in first.h instead of base.h provide lighttpd types in base_decls.h instead of settings.h reduce headers exposed by headers for core data structures do not expose <pcre.h> or <stdlib.h> in headers move stat_cache_entry to stat_cache.h reduce use of "server.h" and "base.h" in headers
* [core] increase stat_cache abstractionGlenn Strauss2018-02-021-1/+2
| | | | | reduce dependency on struct connection routines for getting/caching content_type and etag separate from stat
* [core] remove some unused header includesGlenn Strauss2017-03-281-1/+0
| | | | remove exposure of stdio.h in buffer.h for print_backtrace(), now static
* [autobuild] rm module stub code for missing depsGlenn Strauss2016-10-171-3/+0
| | | | | remove module stub code since the build system(s) no longer build any module when the dependencies for a given module are not present.
* consistent inclusion of config.h at top of files (fixes #2073)Glenn Strauss2016-03-191-0/+2
| | | | | | From: Glenn Strauss <gstrauss@gluelogic.com> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3113 152afb58-edef-0310-8abb-c4023f1b3aa9
* add handling for lua 5.2 and 5.3 (fixes #2674)Stefan Bühler2016-01-031-9/+1
| | | | | | | | | | Reviewers: stbuehler Differential Revision: https://review.lighttpd.net/D4 From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3070 152afb58-edef-0310-8abb-c4023f1b3aa9
* fix buffer, chunk and http_chunk APIStefan Bühler2015-02-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remove unused structs and functions (buffer_array, read_buffer) * change return type from int to void for many functions, as the return value (indicating error/success) was never checked, and the function would only fail on programming errors and not on invalid input; changed functions to use force_assert instead of returning an error. * all "len" parameters now are the real size of the memory to be read. the length of strings is given always without the terminating 0. * the "buffer" struct still counts the terminating 0 in ->used, provide buffer_string_length() to get the length of a string in a buffer. unset config "strings" have used == 0, which is used in some places to distinguish unset values from "" (empty string) values. * most buffer usages should now use it as string container. * optimise some buffer copying by "moving" data to other buffers * use (u)intmax_t for generic int-to-string functions * remove unused enum values: UNUSED_CHUNK, ENCODING_UNSET * converted BUFFER_APPEND_SLASH to inline function (no macro feature needed) * refactor: create chunkqueue_steal: moving (partial) chunks into another queue * http_chunk: added separate function to terminate chunked body instead of magic handling in http_chunk_append_mem(). http_chunk_append_* now handle empty chunks, and never terminate the chunked body. From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2975 152afb58-edef-0310-8abb-c4023f1b3aa9
* add force_assert() to enforce assertions as simple assert()s are disabled by ↵Stefan Bühler2014-02-161-2/+2
| | | | | | | | -DNDEBUG (fixes #2546) From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2948 152afb58-edef-0310-8abb-c4023f1b3aa9
* Fix header inclusion order, always include "config.h" before any system headerStefan Bühler2009-10-111-3/+3
| | | | git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2624 152afb58-edef-0310-8abb-c4023f1b3aa9
* Added some extra warning options in cmake and fix the resulting warnings ↵Stefan Bühler2009-03-071-2/+2
| | | | | | (unused/static functions) git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2414 152afb58-edef-0310-8abb-c4023f1b3aa9
* - white space cleanup part 2 this time 1.4 ;)Marcus Rückert2006-10-041-3/+3
| | | | | | i hope it helps with merging stuff back to 1.5 git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1371 152afb58-edef-0310-8abb-c4023f1b3aa9
* fix for lua not installedJan Kneschke2006-09-151-2/+6
| | | | git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.11-ssl-fixes@1308 152afb58-edef-0310-8abb-c4023f1b3aa9
* added mod_magnetJan Kneschke2006-09-101-0/+133
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.11-ssl-fixes@1292 152afb58-edef-0310-8abb-c4023f1b3aa9