summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_compress_gzip.c
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@nginx.com>2023-07-21 13:58:37 +0200
committerAlejandro Colomar <alx@kernel.org>2023-10-25 13:38:32 +0200
commit3630425f826c7334592c7d1f2527082cfe43f79d (patch)
tree803cee1db4a0661a3fb2caf4dbe8441ce5c64cd8 /src/nxt_http_compress_gzip.c
parent0569065aa583470b8dd2689f2aae53f57b74fe46 (diff)
downloadunit-3630425f826c7334592c7d1f2527082cfe43f79d.tar.gz
unit-3630425f826c7334592c7d1f2527082cfe43f79d.tar.bz2
Auto: zlib: added --no-zlib.
Related to: HTTP: compress: gzip 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.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/nxt_http_compress_gzip.c b/src/nxt_http_compress_gzip.c
index 169b463d..db675ecf 100644
--- a/src/nxt_http_compress_gzip.c
+++ b/src/nxt_http_compress_gzip.c
@@ -9,8 +9,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <zlib.h>
-
#include <nxt_unit_cdefs.h>
#include "nxt_buf.h"
@@ -25,6 +23,10 @@
#include "nxt_string.h"
#include "nxt_types.h"
+#if (NXT_WITH_ZLIB || __has_include(<zlib.h>))
+#include <zlib.h>
+#endif
+
typedef struct nxt_http_compress_gzip_ctx_s nxt_http_compress_gzip_ctx_t;
@@ -35,7 +37,9 @@ struct nxt_http_compress_gzip_ctx_s {
int8_t level;
+#if (NXT_WITH_ZLIB)
z_stream z;
+#endif
};
@@ -91,6 +95,9 @@ static nxt_http_compress_gzip_ctx_t *
nxt_http_compress_gzip_ctx(nxt_task_t *task, nxt_http_request_t *r,
nxt_http_compress_conf_t *conf)
{
+#if (!NXT_WITH_ZLIB)
+ return NULL;
+#else
int ret;
z_stream *z;
nxt_http_compress_gzip_ctx_t *ctx;
@@ -114,12 +121,14 @@ nxt_http_compress_gzip_ctx(nxt_task_t *task, nxt_http_request_t *r,
}
return ctx;
+#endif
}
static void
nxt_http_compress_gzip_filter(nxt_task_t *task, void *obj, void *data)
{
+#if (NXT_WITH_ZLIB)
int ret;
ssize_t size;
z_stream *z;
@@ -180,4 +189,5 @@ fail:
}
return;
+#endif
}