mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-03-06 15:41:36 +01:00
MINOR: compression: disable on multipart or status != 200
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.
This commit is contained in:
parent
859550e068
commit
d300261bab
@ -1916,7 +1916,9 @@ compression offload
|
||||
|
||||
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).
|
||||
|
||||
@ -2060,6 +2060,10 @@ int select_compression_response_header(struct session *s, struct buffer *res)
|
||||
if (!(msg->flags & HTTP_MSGF_VER_11))
|
||||
goto fail;
|
||||
|
||||
/* 200 only */
|
||||
if (txn->status != 200)
|
||||
goto fail;
|
||||
|
||||
ctx.idx = 0;
|
||||
|
||||
/* Content-Length is null */
|
||||
@ -2093,6 +2097,13 @@ int select_compression_response_header(struct session *s, struct buffer *res)
|
||||
|
||||
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user