From 4b86ad6d473f24b4ed8ad846a65e09376e064308 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Thu, 10 Oct 2024 17:06:36 +0100 Subject: http: Compress application responses This adds initial support for compressing application responses. A couple of things to note 1) Compressed responses are sent 'chunked' as we don't know beforehand how large the compressed response will be. 2) We only compress responses where we know the Content-Length as we need to check with the 'min_length' config parameter. It's also currently how we track when we need to close the compression stream off. Co-authored-by: Alejandro Colomar Signed-off-by: Alejandro Colomar Signed-off-by: Andrew Clayton --- src/nxt_http_compression.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nxt_http_compression.h') diff --git a/src/nxt_http_compression.h b/src/nxt_http_compression.h index 9f3567c1..f178e984 100644 --- a/src/nxt_http_compression.h +++ b/src/nxt_http_compression.h @@ -90,6 +90,8 @@ extern const nxt_http_comp_operations_t nxt_http_comp_brotli_ops; #endif +extern nxt_int_t nxt_http_comp_compress_app_response(nxt_task_t *task, + nxt_http_request_t *r, nxt_buf_t **b); extern nxt_int_t nxt_http_comp_compress_static_response(nxt_task_t *task, nxt_file_t **f, nxt_file_info_t *fi, size_t static_buf_len, size_t *out_total); -- cgit