summaryrefslogtreecommitdiff
path: root/src/mod_deflate.c
Commit message (Collapse)AuthorAgeFilesLines
* [build] _WIN32 __declspec(dllexport) *_plugin_initGlenn Strauss2023-05-031-0/+1
| | | | _WIN32 __declspec(dllexport) on mod_*_plugin_init()
* [mod_deflate] _WIN32 disable deflate.cache-dirGlenn Strauss2023-05-031-0/+6
| | | | | | | | _WIN32 disable deflate.cache-dir due to NTFS filesystem limitations deflate.cache-dir renames files into place and this fails if the files are open (source or destination). deflate.cache-dir would have to be reworked to fail gracefully and continue serving request if the final rename fails.
* [core] _WIN32 sys-unistd.h to wrap <unistd.h>Glenn Strauss2023-05-031-1/+1
| | | | (selective implementations; not complete)
* [multiple] _WIN32 stat() compat sys-stat.hGlenn Strauss2023-05-031-5/+1
| | | | | | | no lstat() no S_IFSOCK no S_ISSOCK() ...
* [multiple] clang -Wstrict-prototypes for C2xGlenn Strauss2023-01-191-1/+1
| | | | | | | | | | | adjustments to compile warnings-free with recent clang changes that warn about potential behavior change for non-prototypes, including generic function pointers e.g. int(*)() x-ref: https://discourse.llvm.org/t/rfc-enabling-wstrict-prototypes-by-default-in-c/60521 https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2432.pdf https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2841.htm
* [multiple] quiet some coverity false positivesGlenn Strauss2023-01-131-0/+3
|
* [mod_deflate] "deflate" should include zlib headerGlenn Strauss2023-01-011-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | (thx schaschlik) RFC 2616 3.5 Content Codings https://www.rfc-editor.org/rfc/rfc2616#section-3.5 deflate The "zlib" format defined in RFC 1950 [31] in combination with the "deflate" compression mechanism described in RFC 1951 [29]. RFC 7230 4.2.2. Deflate Coding https://www.rfc-editor.org/rfc/rfc7230#section-4.2.2 RFC 9110 8.4.1.2. Deflate Coding https://datatracker.ietf.org/doc/html/rfc9110#section-8.4.1.2 The "deflate" coding is a "zlib" data format [RFC1950] containing a "deflate" compressed data stream [RFC1951] that uses a combination of the Lempel-Ziv (LZ77) compression algorithm and Huffman coding. Note: Some non-conformant implementations send the "deflate" compressed data without the zlib wrapper.
* [multiple] employ ck_calloc, ck_malloc shared codeGlenn Strauss2022-12-101-13/+6
| | | | | 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/+2
|
* [core] http_response_body_clear clears body flagsGlenn Strauss2022-11-231-0/+1
| | | | | | http_response_body_clear() clears body flags r->resp_body_started r->resp_body_finished
* [mod_deflate] skip cache for Cache-Control: private,no-storeGlenn Strauss2022-11-231-1/+9
| | | | skip deflate cache for Cache-Control 'private' or 'no-store' responses
* [mod_deflate] fix use of libdeflate for files>128k (fixes #3161)Glenn Strauss2022-07-181-2/+2
| | | | | | | | | | | must use mmap MAP_SHARED for writes to modify file on disk (MAP_PRIVATE does not modify underlying file on disk) (thx flynn) x-ref: "gzip dynamic compression broken with source size bigger than 128k" https://redmine.lighttpd.net/issues/3161
* [multiple] application/javascript text/javascriptGlenn Strauss2022-05-261-0/+3
| | | | | | | | | | translate MIME type "application/javascript" to "text/javascript" (if required, type may still be overwritten by mod_setenv or mod_magnet) x-ref: "Updates to ECMAScript Media Types" https://www.rfc-editor.org/rfc/rfc9239
* [multiple] use buffer_append_char()Glenn Strauss2022-05-111-2/+2
|
* [multiple] recognize HTTP QUERY methodGlenn Strauss2022-05-051-1/+1
| | | | | x-ref: https://www.ietf.org/id/draft-ietf-httpbis-safe-method-w-body-02.html
* [core] chunk_file_pread() to wrap pread()Glenn Strauss2022-02-191-18/+2
|
* [mod_deflate] improve loop compressing file chunkGlenn Strauss2022-02-191-19/+41
|
* [mod_deflate] use pread if availableGlenn Strauss2022-02-191-2/+10
|
* [multiple] shared code for struct chunk and mmapGlenn Strauss2022-02-191-60/+23
| | | | | | | | | | | | | | | | | | | chunkqueue_chunk_file_view() reduces size of struct chunk use mmap with mod_deflate libdeflate, if mmap available, even when lighttpd not built with --enable-mmap avoid using mmap on temp files in chunkqueue (c->file.is_temp) since pread() with a reasonable block size is typically as fast or faster than mmap on files read sequentially and used only once, especially when writing results to limited-size socket buffers (and lighttpd temp files are, in most cases, by default about 1 MB) (Exception: sometimes mmap is used for convenience or to fulfill a requirement, e.g. one-shot libdeflate in mod_deflate) (There are many factors which influence speed of mmap versus pread, so this should not be construed as generic usage advice.)
* [multiple] use new sys_setjmp_eval3() interfaceGlenn Strauss2022-02-191-51/+46
| | | | | wrap system os setjmp or compiler try/catch and access mmap inside callback to protect against SIGBUS (or _WIN32 EXCEPTION_IN_PAGE_ERROR)
* [mod_deflate] mark input bytes constGlenn Strauss2022-02-141-6/+7
|
* [mod_deflate] prototype using libdeflate w/ mmapGlenn Strauss2022-02-141-0/+224
|
* [mod_deflate] collect mmap codeGlenn Strauss2022-02-091-139/+95
| | | | mmap entire file to compress on 64-bit systems
* [mod_deflate] fix to return 304 with If-None-Match (fixes #3143)Glenn Strauss2022-01-301-1/+1
| | | | | | | | | | | | (thx meier22) Bug in lighttpd 1.4.51 - lighttpd 1.4.64 x-ref: "mod_deflate not returning 304 Not Modified for If-None-Match request" https://redmine.lighttpd.net/issues/3143 "How to get 304 Not Modified - response with mod_deflate" https://redmine.lighttpd.net/boards/2/topics/10253
* [multiple] remove r->physical.etagGlenn Strauss2021-12-121-2/+0
| | | | (no longer used; was used as temporary buffer)
* [core] quiet compiler warningsGlenn Strauss2021-09-041-0/+2
| | | | | | | | | | 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_deflate] use http_header_str_contains_tokenGlenn Strauss2021-09-041-3/+4
|
* [mod_deflate] improve compress.*->deflate.* remapGlenn Strauss2021-08-271-37/+34
|
* [mod_deflate] use brotli quality 5 by defaultGlenn Strauss2021-08-271-2/+4
| | | | | | | | | | | | BROTLI_DEFAULT_QUALITY is 11, which may lead to a higher compression ratio, but potentially at a cost of taking *many* multiples of the time taken to compress at quality level 5. x-ref: https://almanac.httparchive.org/en/2020/compression#fig-3 https://blog.cloudflare.com/results-experimenting-brotli/ https://blogs.akamai.com/2016/02/understanding-brotlis-potential.html https://expeditedsecurity.com/blog/nginx-brotli/
* [mod_deflate] deflate.params per-encoder paramsGlenn Strauss2021-08-271-28/+276
| | | | | | | | | | | | | | mechanism to define per-encoder params parsed into structured data at startup compression level is the initial target deflate.params is a better solution to the deflate.compression-level, which is a single range 1-9 that is overload and applied to all encoders without any scaling, even though encoders might have different scales. x-ref: "ModDeflate questions (possibly some feature requests too)" https://redmine.lighttpd.net/boards/2/topics/9786
* [mod_deflate] use ZSTD_c_strategy w/ compress lvlGlenn Strauss2021-08-271-1/+1
| | | | | | | | | | map deflate.compression-level to ZSTD_c_strategy as the current enum for ZSTD_strategy is in the range 1 .. 9, which matches the gzip compression level 1 .. 9 range x-ref: "ModDeflate questions (possibly some feature requests too)" https://redmine.lighttpd.net/boards/2/topics/9786
* [mod_deflate] use deflate.allowed-encodings orderGlenn Strauss2021-08-271-42/+59
| | | | | | | | | use deflate.allowed-encodings ordering as server preference list when choosing an encoding from list in client request Accept header x-ref: "ModDeflate questions (possibly some feature requests too)" https://redmine.lighttpd.net/boards/2/topics/9786
* [core] move backtrace and assert macros to ck.[ch]Glenn Strauss2021-08-271-1/+2
|
* [multiple] reduce redundant NULL buffer checksGlenn Strauss2021-08-271-22/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] buffer_copy_path_len2() aggregateGlenn Strauss2021-04-021-2/+2
|
* [multiple] use buffer_append_* aggregatesGlenn Strauss2021-04-021-4/+5
| | | | reduces the number of round-trips into some frequently-called routines
* [multiple] http_header APIs to reduce str copiesGlenn Strauss2021-03-261-4/+3
|
* [mod_deflate] do not cache 206 Partial ContentGlenn Strauss2021-02-241-2/+2
|
* [mod_deflate] compat with zstd < v1.4.0Glenn Strauss2021-01-171-0/+16
| | | | | ZSTD_compressStream2() was an "advanced API" (experimental; unstable) in v1.3.x
* [mod_deflate] use zstd typedefs (minor cleanup)Glenn Strauss2021-01-171-13/+13
|
* [mod_deflate] use zstd streaming APIGlenn Strauss2021-01-121-41/+39
|
* [mod_deflate] support Accept-Encoding: zstdGlenn Strauss2021-01-121-3/+124
|
* [multiple] etag.[ch] -> http_etag.[ch]; better impGlenn Strauss2020-12-251-1/+1
| | | | | | more efficient implementation of HTTP ETag generation and comparison modify dekhash() to take hash value to allow for incremental hashing
* [core] silence coverity warnings (false positives)Glenn Strauss2020-10-201-0/+4
|
* [multiple] use http_chunk_append_file_ref()Glenn Strauss2020-10-201-3/+1
| | | | | | | use http_chunk_append_file_ref() and http_chunk_append_file_ref_range() reduce resource usage (number of fds open) by reference counting open fds to files served, and sharing the fd among FILE_CHUNKs in responses
* [mod_deflate] use large mmap chunks to compressGlenn Strauss2020-10-201-13/+13
| | | | | use large chunks since server blocks while compressing, anyway (mod_deflate is not recommended for large files)
* [multiple] remove chunk file.start memberGlenn Strauss2020-10-191-10/+5
| | | | | | c->offset is now offset into file c->file.length is end of octets to send (end pos + 1) c->file.length - c->offset is num of octets to send
* [core,mod_deflate] leverage cache of open fdGlenn Strauss2020-10-191-2/+4
| | | | | | | | leverage simple cache of open file in stat_cache (use stat_cache_get_entry_open()) future: reference count fd instead of dup() (requires extending chunkqueue interfaces)
* [mod_deflate] fix potential NULL deref in err caseGlenn Strauss2020-10-111-1/+1
| | | | (bug on master branch; never released)