]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: http-ana: don't stop waiting for the body on a NOOP block
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Dec 2026 09:10:49 +0000 (10:10 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Dec 2026 12:41:06 +0000 (13:41 +0100)
In http_wait_for_msg_body(), all the payload was considered as received
when the tail block of the HTX message was of a type greater than
HTX_BLK_DATA, to detect the trailers. But since the commit 221c40bbf
("MINOR: htx: Add a noop block to carry the EOM flag on an empty
message"), a NOOP block may be found anywhere in the message and its type
is greater than HTX_BLK_DATA. So a NOOP block without the EOM flag at the
end of the message stopped the wait, the rules being evaluated on a
partial payload. For now, such block can only be produced by the
HTTPMessage:unset_eom() Lua function.

Now, only TLR and EOT blocks are considered.

This patch must be backported to 3.5.

src/http_ana.c

index c2f23821d22811a8b81019f3ffba05a12a1620e1..87ed66e5ffcae1dd151e6a7ec2ee997e2a843d9c 100644 (file)
@@ -4462,9 +4462,13 @@ enum rule_result http_wait_for_msg_body(struct stream *s, struct channel *chn,
        }
 
        /* Now we're are waiting for the payload. We just need to know if all
-        * data have been received or if the buffer is full.
+        * data have been received or if the buffer is full. All data were
+        * received if the end of the message was reached or if the trailers
+        * were received. Note a NOOP block may be found anywhere in the
+        * message, so it must not be considered here.
         */
-       if (htx_msg_ended(htx) || htx_get_tail_type(htx) > HTX_BLK_DATA)
+       if (htx_msg_ended(htx) ||
+           htx_get_tail_type(htx) == HTX_BLK_TLR || htx_get_tail_type(htx) == HTX_BLK_EOT)
                goto end; /* all data received */
 
        if (bytes) {