diff options
| author | Andrew Clayton <a.clayton@nginx.com> | 2024-11-20 16:13:46 +0000 |
|---|---|---|
| committer | Andrew Clayton <a.clayton@nginx.com> | 2025-04-14 18:11:53 +0100 |
| commit | 47cbbbbff9b1d3a166355b8a242b623f796db6df (patch) | |
| tree | b234d3f7a6a44db049997a5d37115bca78931572 /src/nxt_http_compression.c | |
| parent | 94dffe47f9094f71f0e35883fc57d1aa30abf656 (diff) | |
| download | unit-47cbbbbff9b1d3a166355b8a242b623f796db6df.tar.gz unit-47cbbbbff9b1d3a166355b8a242b623f796db6df.tar.bz2 | |
http: Add zlib compression support
This adds support for both deflate & gzip compressors.
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'src/nxt_http_compression.c')
| -rw-r--r-- | src/nxt_http_compression.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nxt_http_compression.c b/src/nxt_http_compression.c index f35afeff..2ce415fe 100644 --- a/src/nxt_http_compression.c +++ b/src/nxt_http_compression.c @@ -27,6 +27,10 @@ typedef struct nxt_http_comp_ctx_s nxt_http_comp_ctx_t; enum nxt_http_comp_scheme_e { NXT_HTTP_COMP_SCHEME_IDENTITY = 0, +#if NXT_HAVE_ZLIB + NXT_HTTP_COMP_SCHEME_DEFLATE, + NXT_HTTP_COMP_SCHEME_GZIP, +#endif /* keep last */ NXT_HTTP_COMP_SCHEME_UNKNOWN @@ -89,6 +93,22 @@ static const nxt_http_comp_type_t nxt_http_comp_compressors[] = { { .token = nxt_string("identity"), .scheme = NXT_HTTP_COMP_SCHEME_IDENTITY, +#if NXT_HAVE_ZLIB + }, { + .token = nxt_string("deflate"), + .scheme = NXT_HTTP_COMP_SCHEME_DEFLATE, + .def_compr = NXT_HTTP_COMP_ZLIB_DEFAULT_LEVEL, + .comp_min = NXT_HTTP_COMP_ZLIB_COMP_MIN, + .comp_max = NXT_HTTP_COMP_ZLIB_COMP_MAX, + .cops = &nxt_http_comp_deflate_ops, + }, { + .token = nxt_string("gzip"), + .scheme = NXT_HTTP_COMP_SCHEME_GZIP, + .def_compr = NXT_HTTP_COMP_ZLIB_DEFAULT_LEVEL, + .comp_min = NXT_HTTP_COMP_ZLIB_COMP_MIN, + .comp_max = NXT_HTTP_COMP_ZLIB_COMP_MAX, + .cops = &nxt_http_comp_gzip_ops, +#endif }, }; |
