BUG/MINOR: http-comp: Preserve HTTP_MSGF_COMPRESSIONG flag on the response

This flag is set on the response when its payload is compressed by HAProxy.
It must be preserved because it may be used when the log message is emitted.

When the compression filter was refactored to support the HTX, an
optimization was added to not perform extra proessing on the trailers.
HTTP_MSGF_COMPRESSIONG flag is removed when the last data block is
compressed. It is not required, it is just an optimization and unfortunately
a bug. This optimization must be removed to preserve the flag.

This patch must be backported as far as 2.0. On the HTX is affected.
This commit is contained in:
Christopher Faulet 2021-05-21 09:49:20 +02:00
parent a6d3704e38
commit acfd71b97a

View File

@ -183,9 +183,6 @@ comp_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg,
while (next && htx_get_blk_type(next) == HTX_BLK_UNUSED) while (next && htx_get_blk_type(next) == HTX_BLK_UNUSED)
next = htx_get_next_blk(htx, blk); next = htx_get_next_blk(htx, blk);
if (!(msg->flags & HTTP_MSGF_COMPRESSING))
goto consume;
if (htx_compression_buffer_init(htx, &trash) < 0) { if (htx_compression_buffer_init(htx, &trash) < 0) {
msg->chn->flags |= CF_WAKE_WRITE; msg->chn->flags |= CF_WAKE_WRITE;
goto end; goto end;
@ -215,8 +212,6 @@ comp_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg,
len -= ret; len -= ret;
consumed += ret; consumed += ret;
to_forward += b_data(&trash); to_forward += b_data(&trash);
if (last)
msg->flags &= ~HTTP_MSGF_COMPRESSING;
break; break;
case HTX_BLK_TLR: case HTX_BLK_TLR:
@ -232,7 +227,6 @@ comp_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg,
goto error; goto error;
to_forward += b_data(&trash); to_forward += b_data(&trash);
} }
msg->flags &= ~HTTP_MSGF_COMPRESSING;
/* fall through */ /* fall through */
default: default: