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.h | |
| 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.h')
| -rw-r--r-- | src/nxt_http_compression.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nxt_http_compression.h b/src/nxt_http_compression.h index 4e63d34d..abfecd92 100644 --- a/src/nxt_http_compression.h +++ b/src/nxt_http_compression.h @@ -12,12 +12,23 @@ #include <stdint.h> #include <stdbool.h> +#if NXT_HAVE_ZLIB +#include <zlib.h> +#endif + #include <nxt_main.h> #include <nxt_router.h> #include <nxt_string.h> #include <nxt_conf.h> +#if NXT_HAVE_ZLIB +#define NXT_HTTP_COMP_ZLIB_DEFAULT_LEVEL Z_DEFAULT_COMPRESSION +#define NXT_HTTP_COMP_ZLIB_COMP_MIN Z_DEFAULT_COMPRESSION +#define NXT_HTTP_COMP_ZLIB_COMP_MAX Z_BEST_COMPRESSION +#endif + + typedef struct nxt_http_comp_compressor_ctx_s nxt_http_comp_compressor_ctx_t; typedef struct nxt_http_comp_operations_s nxt_http_comp_operations_t; @@ -25,6 +36,9 @@ struct nxt_http_comp_compressor_ctx_s { int8_t level; union { +#if NXT_HAVE_ZLIB + z_stream zlib_ctx; +#endif }; }; @@ -38,6 +52,12 @@ struct nxt_http_comp_operations_s { }; +#if NXT_HAVE_ZLIB +extern const nxt_http_comp_operations_t nxt_http_comp_deflate_ops; +extern const nxt_http_comp_operations_t nxt_http_comp_gzip_ops; +#endif + + extern bool nxt_http_comp_wants_compression(void); extern bool nxt_http_comp_compressor_is_valid(const nxt_str_t *token); extern nxt_int_t nxt_http_comp_check_compression(nxt_task_t *task, |
