summaryrefslogtreecommitdiff
path: root/src/mod_compress.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mod_compress.c')
-rw-r--r--src/mod_compress.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/mod_compress.c b/src/mod_compress.c
index 41ad68d1..279645b2 100644
--- a/src/mod_compress.c
+++ b/src/mod_compress.c
@@ -22,20 +22,18 @@
#include <errno.h>
#include <time.h>
-#if defined HAVE_ZLIB_H && defined HAVE_LIBZ
-# define USE_ZLIB
+
+#if defined WITH_ZLIB
# include <zlib.h>
#endif
-#if defined HAVE_BZLIB_H && defined HAVE_LIBBZ2
-# define USE_BZ2LIB
+#if defined WITH_BZIP
/* we don't need stdio interface */
# define BZ_NO_STDIO
# include <bzlib.h>
#endif
-#if defined HAVE_SYS_MMAN_H && defined HAVE_MMAP && defined ENABLE_MMAP
-#define USE_MMAP
+#if defined(USE_MMAP)
#include "sys-mmap.h"
#include <setjmp.h>
@@ -49,7 +47,8 @@ static void sigbus_handler(int sig) {
if (sigbus_jmp_valid) siglongjmp(sigbus_jmp, 1);
log_failed_assert(__FILE__, __LINE__, "SIGBUS");
}
-#endif
+
+#endif /* USE_MMAP */
/* request: accept-encoding */
#define HTTP_ACCEPT_ENCODING_IDENTITY BV(0)
@@ -226,10 +225,10 @@ SETDEFAULTS_FUNC(mod_compress_setdefaults) {
if (encodings_arr->used) {
size_t j = 0;
for (j = 0; j < encodings_arr->used; j++) {
-#if defined(USE_ZLIB) || defined(USE_BZ2LIB)
+#if defined(WITH_ZLIB) || defined(USE_BZ2LIB)
data_string *ds = (data_string *)encodings_arr->data[j];
#endif
-#ifdef USE_ZLIB
+#ifdef WITH_ZLIB
if (NULL != strstr(ds->value->ptr, "gzip"))
s->allowed_encodings |= HTTP_ACCEPT_ENCODING_GZIP | HTTP_ACCEPT_ENCODING_X_GZIP;
if (NULL != strstr(ds->value->ptr, "x-gzip"))
@@ -251,7 +250,7 @@ SETDEFAULTS_FUNC(mod_compress_setdefaults) {
} else {
/* default encodings */
s->allowed_encodings = 0
-#ifdef USE_ZLIB
+#ifdef WITH_ZLIB
| HTTP_ACCEPT_ENCODING_GZIP | HTTP_ACCEPT_ENCODING_X_GZIP | HTTP_ACCEPT_ENCODING_DEFLATE
#endif
#ifdef USE_BZ2LIB
@@ -279,7 +278,7 @@ SETDEFAULTS_FUNC(mod_compress_setdefaults) {
}
-#ifdef USE_ZLIB
+#ifdef WITH_ZLIB
static int deflate_file_to_buffer_gzip(server *srv, connection *con, plugin_data *p, char *start, off_t st_size, time_t mtime) {
unsigned char *c;
unsigned long crc;
@@ -603,7 +602,7 @@ static int deflate_file_to_file(server *srv, connection *con, plugin_data *p, bu
ret = -1;
switch(type) {
-#ifdef USE_ZLIB
+#ifdef WITH_ZLIB
case HTTP_ACCEPT_ENCODING_GZIP:
case HTTP_ACCEPT_ENCODING_X_GZIP:
ret = deflate_file_to_buffer_gzip(srv, con, p, start, sce->st.st_size, sce->st.st_mtime);
@@ -715,7 +714,7 @@ static int deflate_file_to_buffer(server *srv, connection *con, plugin_data *p,
}
switch(type) {
-#ifdef USE_ZLIB
+#ifdef WITH_ZLIB
case HTTP_ACCEPT_ENCODING_GZIP:
case HTTP_ACCEPT_ENCODING_X_GZIP:
ret = deflate_file_to_buffer_gzip(srv, con, p, start, sce->st.st_size, sce->st.st_mtime);
@@ -907,7 +906,7 @@ PHYSICALPATH_FUNC(mod_compress_physical) {
int use_etag = sce->etag != NULL && sce->etag->ptr != NULL;
/* get client side support encodings */
-#ifdef USE_ZLIB
+#ifdef WITH_ZLIB
if (mod_compress_contains_encoding(value, CONST_STR_LEN("gzip"))) accept_encoding |= HTTP_ACCEPT_ENCODING_GZIP;
if (mod_compress_contains_encoding(value, CONST_STR_LEN("x-gzip"))) accept_encoding |= HTTP_ACCEPT_ENCODING_X_GZIP;
if (mod_compress_contains_encoding(value, CONST_STR_LEN("deflate"))) accept_encoding |= HTTP_ACCEPT_ENCODING_DEFLATE;