From 804ca81fd958cd29bd52296063224fc73d40c42f Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Wed, 20 Nov 2024 16:20:57 +0000 Subject: http: Add support for brotli compression Signed-off-by: Andrew Clayton --- src/nxt_http_compression.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/nxt_http_compression.h') diff --git a/src/nxt_http_compression.h b/src/nxt_http_compression.h index 7c731a86..c2007f8e 100644 --- a/src/nxt_http_compression.h +++ b/src/nxt_http_compression.h @@ -20,6 +20,10 @@ #include #endif +#if NXT_HAVE_BROTLI +#include +#endif + #include #include #include @@ -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; @@ -50,6 +59,9 @@ struct nxt_http_comp_compressor_ctx_s { #endif #if NXT_HAVE_ZSTD ZSTD_CStream *zstd_ctx; +#endif +#if NXT_HAVE_BROTLI + BrotliEncoderState *brotli_ctx; #endif }; }; @@ -73,6 +85,10 @@ extern const nxt_http_comp_operations_t nxt_http_comp_gzip_ops; extern const nxt_http_comp_operations_t nxt_http_comp_zstd_ops; #endif +#if NXT_HAVE_BROTLI +extern const nxt_http_comp_operations_t nxt_http_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); -- cgit