diff options
| author | Andrew Clayton <a.clayton@nginx.com> | 2024-11-20 16:19:29 +0000 |
|---|---|---|
| committer | Andrew Clayton <a.clayton@nginx.com> | 2024-11-29 00:45:24 +0000 |
| commit | 87665a5b1f415bad309cffb96c2885971cc0de4b (patch) | |
| tree | 003a744e254828882b309c7d3a700f8c66e32929 /src/nxt_http_compression.h | |
| parent | 9e836e683f1125955e6d69afd90e8fac328f1b4b (diff) | |
| download | unit-87665a5b1f415bad309cffb96c2885971cc0de4b.tar.gz unit-87665a5b1f415bad309cffb96c2885971cc0de4b.tar.bz2 | |
http: Add support for zstd compression
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 | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nxt_http_compression.h b/src/nxt_http_compression.h index c67cd001..2d51d2a5 100644 --- a/src/nxt_http_compression.h +++ b/src/nxt_http_compression.h @@ -16,6 +16,10 @@ #include <zlib.h> #endif +#if NXT_HAVE_ZSTD +#include <zstd.h> +#endif + #include <nxt_main.h> #include <nxt_router.h> #include <nxt_string.h> @@ -27,6 +31,11 @@ #define NXT_HTTP_COMP_ZLIB_COMP_MIN Z_DEFAULT_COMPRESSION #define NXT_HTTP_COMP_ZLIB_COMP_MAX Z_BEST_COMPRESSION #endif +#if NXT_HAVE_ZSTD +#define NXT_HTTP_COMP_ZSTD_DEFAULT_LEVEL ZSTD_CLEVEL_DEFAULT +#define NXT_HTTP_COMP_ZSTD_COMP_MIN (-7) +#define NXT_HTTP_COMP_ZSTD_COMP_MAX 22 +#endif typedef struct nxt_http_comp_compressor_ctx_s nxt_http_comp_compressor_ctx_t; @@ -39,6 +48,9 @@ struct nxt_http_comp_compressor_ctx_s { #if NXT_HAVE_ZLIB z_stream zlib_ctx; #endif +#if NXT_HAVE_ZSTD + ZSTD_CStream *zstd_ctx; +#endif }; }; @@ -58,6 +70,10 @@ extern const nxt_http_comp_operations_t nxt_comp_deflate_ops; extern const nxt_http_comp_operations_t nxt_comp_gzip_ops; #endif +#if NXT_HAVE_ZSTD +extern const nxt_http_comp_operations_t nxt_comp_zstd_ops; +#endif + extern bool nxt_http_comp_wants_compression(void); extern bool nxt_http_comp_compressor_is_valid(const nxt_str_t *token); |
