The compression is disabled when the HTTP status code is not 200, indeed
compression on some HTTP code can create issues (ex: 206, 416).
Multipart message should not be compressed eitherway.
Compression is disabled when:
* the server is not HTTP/1.1.
+ * HTTP status code is not 200
* requests does not contain Transfer-Encoding: chunked or Content-Length.
+ * Content-Type is multipart
* the request contains "Cache-control: no-transform".
* User-Agent matches "Mozilla/4" except MSIE 6 with XP SP2, or MSIE 7 and later.
* The response is already compressed (see compression offload).
if (!(msg->flags & HTTP_MSGF_VER_11))
goto fail;
+ /* 200 only */
+ if (txn->status != 200)
+ goto fail;
+
ctx.idx = 0;
/* Content-Length is null */
ctx.idx = 0;
+ /* Don't compress multipart */
+ if (http_find_header2("Content-Type", 12, res->p, &txn->hdr_idx, &ctx)) {
+ if (strncasecmp("multipart", ctx.line+ctx.val, 9) == 0)
+ goto fail;
+
+ }
+
/* limit compression rate */
if (global.comp_rate_lim > 0)
if (read_freq_ctr(&global.comp_bps_in) > global.comp_rate_lim)