55#include "sentry_ratelimiter.h"
66#include "sentry_string.h"
77
8- #include "zlib.h"
8+ #ifdef GZIP_COMPRESSION
9+ include "zlib.h"
10+ #endif
911
1012#define ENVELOPE_MIME "application/x-sentry-envelope"
1113// The headers we use are: `x-sentry-auth`, `content-type`, `content-encoding`, `content-length`
@@ -150,6 +152,7 @@ sentry_transport_free(sentry_transport_t *transport)
150152 sentry_free (transport );
151153}
152154
155+ #ifdef GZIP_COMPRESSION
153156static bool
154157gzipped_with_compression (const char * body , const size_t body_len ,
155158 char * * compressed_body , size_t * compressed_body_len )
@@ -197,6 +200,7 @@ gzipped_with_compression(const char *body, const size_t body_len,
197200 deflateEnd (& stream );
198201 return true;
199202}
203+ #endif
200204
201205sentry_prepared_http_request_t *
202206sentry__prepare_http_request (sentry_envelope_t * envelope ,
@@ -215,9 +219,11 @@ sentry__prepare_http_request(sentry_envelope_t *envelope,
215219 return NULL ;
216220 }
217221
222+ bool compressed = false;
223+ #ifdef GZIP_COMPRESSION
218224 char * compressed_body = NULL ;
219225 size_t compressed_body_len = 0 ;
220- bool compressed = gzipped_with_compression (
226+ compressed = gzipped_with_compression (
221227 body , body_len , & compressed_body , & compressed_body_len );
222228 if (compressed ) {
223229 if (body_owned ) {
@@ -228,6 +234,7 @@ sentry__prepare_http_request(sentry_envelope_t *envelope,
228234 body_len = compressed_body_len ;
229235 body_owned = true;
230236 }
237+ #endif
231238
232239 sentry_prepared_http_request_t * req
233240 = SENTRY_MAKE (sentry_prepared_http_request_t );
0 commit comments