diff options
| author | Andrew Clayton <a.clayton@nginx.com> | 2024-11-20 16:20:57 +0000 |
|---|---|---|
| committer | Andrew Clayton <a.clayton@nginx.com> | 2024-11-29 00:45:24 +0000 |
| commit | 0de46a7db5d443bfc0e15cfbe654387377690d2e (patch) | |
| tree | 52310c95bd52f1f825877934375ac9dc46feff2c /src/nxt_http_compression.h | |
| parent | 87665a5b1f415bad309cffb96c2885971cc0de4b (diff) | |
| download | unit-0de46a7db5d443bfc0e15cfbe654387377690d2e.tar.gz unit-0de46a7db5d443bfc0e15cfbe654387377690d2e.tar.bz2 | |
http: Add support for brotli compression
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to '')
| -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 2d51d2a5..c88e4033 100644 --- a/src/nxt_http_compression.h +++ b/src/nxt_http_compression.h @@ -20,6 +20,10 @@ #include <zstd.h> #endif +#if NXT_HAVE_BROTLI +#include <brotli/encode.h> +#endif + #include <nxt_main.h> #include <nxt_router.h> #include <nxt_string.h> @@ -36,6 +40,11 @@ #define NXT_HTTP_COMP_ZSTD_COMP_MIN (-7) #define NXT_HTTP_COMP_ZSTD_COMP_MAX 22 #endif +#if NXT_HAVE_BROTLI +#define NXT_HTTP_COMP_BROTLI_DEFAULT_LEVEL BROTLI_DEFAULT_QUALITY +#define NXT_HTTP_COMP_BROTLI_COMP_MIN BROTLI_MIN_QUALITY +#define NXT_HTTP_COMP_BROTLI_COMP_MAX BROTLI_MAX_QUALITY +#endif typedef struct nxt_http_comp_compressor_ctx_s nxt_http_comp_compressor_ctx_t; @@ -51,6 +60,9 @@ struct nxt_http_comp_compressor_ctx_s { #if NXT_HAVE_ZSTD ZSTD_CStream *zstd_ctx; #endif +#if NXT_HAVE_BROTLI + BrotliEncoderState *brotli_ctx; +#endif }; }; @@ -74,6 +86,10 @@ extern const nxt_http_comp_operations_t nxt_comp_gzip_ops; extern const nxt_http_comp_operations_t nxt_comp_zstd_ops; #endif +#if NXT_HAVE_BROTLI +extern const nxt_http_comp_operations_t nxt_comp_brotli_ops; +#endif + extern bool nxt_http_comp_wants_compression(void); extern bool nxt_http_comp_compressor_is_valid(const nxt_str_t *token); |
