diff --git a/include/types/compression.h b/include/types/compression.h index dfff2f97e9..6f418fa057 100644 --- a/include/types/compression.h +++ b/include/types/compression.h @@ -23,8 +23,12 @@ #ifndef _TYPES_COMP_H #define _TYPES_COMP_H +#ifdef USE_ZLIB + #include +#endif /* USE_ZLIB */ + struct comp { struct comp_algo *algos; struct comp_type *types; @@ -32,7 +36,9 @@ struct comp { }; struct comp_ctx { +#ifdef USE_ZLIB z_stream strm; /* zlib stream */ +#endif /* USE_ZLIB */ }; struct comp_algo { diff --git a/include/types/session.h b/include/types/session.h index 5546be8c83..ae11f81790 100644 --- a/include/types/session.h +++ b/include/types/session.h @@ -33,6 +33,7 @@ #include #include + #include #include #include diff --git a/src/compression.c b/src/compression.c index 2c0e4f99ee..1f12df9aec 100644 --- a/src/compression.c +++ b/src/compression.c @@ -13,6 +13,7 @@ #include +#ifdef USE_ZLIB /* Note: the crappy zlib and openssl libs both define the "free_func" type. * That's a very clever idea to use such a generic name in general purpose * libraries, really... The zlib one is easier to redefine than openssl's, @@ -21,6 +22,7 @@ #define free_func zlib_free_func #include #undef free_func +#endif /* USE_ZLIB */ #include @@ -200,6 +202,8 @@ int http_compression_buffer_end(struct session *s, struct buffer **in, struct bu int left; struct http_msg *msg = &s->txn.rsp; struct buffer *ib = *in, *ob = *out; + +#ifdef USE_ZLIB int ret; /* flush data here */ @@ -212,6 +216,8 @@ int http_compression_buffer_end(struct session *s, struct buffer **in, struct bu if (ret < 0) return -1; /* flush failed */ +#endif /* USE_ZLIB */ + if (ob->i > 8) { /* more than a chunk size => some data were emitted */ char *tail = ob->p + ob->i;