]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: flt-http-comp: Rely on htx_set_eom() to restore EOM flag
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 2 Sep 2026 12:45:13 +0000 (14:45 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Sep 2026 08:24:01 +0000 (10:24 +0200)
A theoritical bug was introduced by the commit 30890fd90 ("BUG/MEDIUM:
flt-http-comp: Block HTX_FL_EOM flag till the end of compression"). On the
normal case, the HTX_FL_EOM flag was restored without checking if the HTX
message was empty or not. It could be an issue. Instead, htx_set_eom()
function must be used.

This patch must be backported with the commit above.

src/flt_http_comp.c

index ed0b83f24c72d400081d1390731afdab8272fc11..534ee5f38fd2d886783fc55ebce857badac50d47 100644 (file)
@@ -381,8 +381,12 @@ comp_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg,
        /* The compression is finished and we must now restore the EOM flog on
         * the HTX message.
         */
-       if ((st->flags & (COMP_STATE_PROCESSING|COMP_STATE_EOM_SEEN)) == COMP_STATE_EOM_SEEN)
-               htx->flags |= HTX_FL_EOM;
+       if ((st->flags & (COMP_STATE_PROCESSING|COMP_STATE_EOM_SEEN)) == COMP_STATE_EOM_SEEN) {
+               unsigned int data = htx->data;
+
+               htx_set_eom(htx);
+               to_forward += htx->data - data;
+       }
 
        if (to_forward != consumed)
                flt_update_offsets(filter, msg->chn, to_forward - consumed);