summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_compress_gzip.c
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@nginx.com>2023-08-23 17:23:49 +0200
committerAlejandro Colomar <alx@kernel.org>2023-10-25 13:38:08 +0200
commit0569065aa583470b8dd2689f2aae53f57b74fe46 (patch)
tree9d7e9392d679ca9e8eb2fd54c9a372a2c5185120 /src/nxt_http_compress_gzip.c
parentd05e2ab887602bb3f3f3020ba14f247f1dd18bef (diff)
downloadunit-0569065aa583470b8dd2689f2aae53f57b74fe46.tar.gz
unit-0569065aa583470b8dd2689f2aae53f57b74fe46.tar.bz2
HTTP: compress: added configurable "level" of compression.
Signed-off-by: Alejandro Colomar <alx@nginx.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'src/nxt_http_compress_gzip.c')
-rw-r--r--src/nxt_http_compress_gzip.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nxt_http_compress_gzip.c b/src/nxt_http_compress_gzip.c
index 75ed9155..169b463d 100644
--- a/src/nxt_http_compress_gzip.c
+++ b/src/nxt_http_compress_gzip.c
@@ -7,6 +7,7 @@
#include "nxt_http_compress_gzip.h"
#include <stddef.h>
+#include <stdint.h>
#include <zlib.h>
@@ -32,6 +33,8 @@ struct nxt_http_compress_gzip_ctx_s {
nxt_http_request_t *r;
nxt_buf_t *b;
+ int8_t level;
+
z_stream z;
};
@@ -97,14 +100,15 @@ nxt_http_compress_gzip_ctx(nxt_task_t *task, nxt_http_request_t *r,
return NULL;
}
+ ctx->level = conf->level;
ctx->r = r;
z = &ctx->z;
z->zalloc = NULL;
z->zfree = NULL;
z->opaque = NULL;
- ret = deflateInit2(z, Z_DEFAULT_COMPRESSION, Z_DEFLATED, MAX_WBITS + 16,
- MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);
+ ret = deflateInit2(z, ctx->level, Z_DEFLATED, MAX_WBITS + 16, MAX_MEM_LEVEL,
+ Z_DEFAULT_STRATEGY);
if (nxt_slow_path(ret != 0)) {
return NULL;
}