mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-10-26 22:20:59 +01:00
BUG/MINOR: compression: Test payload size only if content-length is specified
When a minimum size is defined to performe the comression, the message payload size is tested. To do so, information from the HTX message a used to determine the message length. However it is performed regardless the payload length is fully known or not. Concretely, the test must on be performed when a content-length value was speficied or when the message was fully received (EOM flag set). Otherwise, we are unable to really determine the real payload length. Because of this bug, compression may be skipped for a large chunked message because the first chunks received are too small. But this does not mean the whole message is small. This patch must be backported to 3.2.
This commit is contained in:
parent
71199e394c
commit
23e5d272af
@ -151,8 +151,9 @@ comp_prepare_compress_request(struct comp_state *st, struct stream *s, struct ht
|
||||
comp_type = NULL;
|
||||
|
||||
/* compress only if body size is >= than the min size */
|
||||
if ((s->be->comp && (comp_minsize = s->be->comp->minsize_req)) ||
|
||||
(strm_fe(s)->comp && (comp_minsize = strm_fe(s)->comp->minsize_req))) {
|
||||
if (((msg->flags & HTTP_MSGF_CNT_LEN) || (htx->flags & HTX_FL_EOM)) &&
|
||||
((s->be->comp && (comp_minsize = s->be->comp->minsize_req)) ||
|
||||
(strm_fe(s)->comp && (comp_minsize = strm_fe(s)->comp->minsize_req)))) {
|
||||
for (pos = htx_get_first(htx); pos != -1; pos = htx_get_next(htx, pos)) {
|
||||
struct htx_blk *blk = htx_get_blk(htx, pos);
|
||||
enum htx_blk_type type = htx_get_blk_type(blk);
|
||||
@ -684,8 +685,9 @@ select_compression_response_header(struct comp_state *st, struct stream *s, stru
|
||||
goto fail;
|
||||
|
||||
/* compress only if body size is >= than the min size */
|
||||
if ((s->be->comp && (comp_minsize = s->be->comp->minsize_res)) ||
|
||||
(strm_fe(s)->comp && (comp_minsize = strm_fe(s)->comp->minsize_res))) {
|
||||
if (((msg->flags & HTTP_MSGF_CNT_LEN) || (htx->flags & HTX_FL_EOM)) &&
|
||||
((s->be->comp && (comp_minsize = s->be->comp->minsize_res)) ||
|
||||
(strm_fe(s)->comp && (comp_minsize = strm_fe(s)->comp->minsize_res)))) {
|
||||
for (pos = htx_get_first(htx); pos != -1; pos = htx_get_next(htx, pos)) {
|
||||
struct htx_blk *blk = htx_get_blk(htx, pos);
|
||||
enum htx_blk_type type = htx_get_blk_type(blk);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user