From: Christopher Faulet Date: Thu, 3 Dec 2026 09:14:09 +0000 (+0100) Subject: BUG/MEDIUM: mux-fcgi: accept a request ended by trailers without the EOM X-Git-Url: https://git.kaiwu.me/web/http/static/%7B@url%7D?a=commitdiff_plain;h=60d6b953f68dc5590c4aadc9d707e0dbe1817b8e;p=haproxy.git BUG/MEDIUM: mux-fcgi: accept a request ended by trailers without the EOM When the first record of a request is sent, the length of the body must be known, either because a content-length was announced or because the whole message was received. In this last case, the tail block of the HTX message must carry the EOM flag. But since the commit 221c40bbf ("MINOR: htx: Add a noop block to carry the EOM flag on an empty message"), an EOT block without the EOM flag is a valid state, the EOM flag being reported later on a NOOP block. It happens for instance when an H3 request is received with trailers, the FIN being received in a separate frame. The wait for the request body stops on the trailers, the payload being fully received. So such request was rejected by the FCGI mux with a parsing error. Now, the request is also accepted when the tail block is an EOT block. The CONTENT_LENGTH parameter is already computed by counting the DATA blocks up to the trailers. The empty STDIN record will be sent on the NOOP block carrying the EOM flag. This patch must be backported to 3.5. --- diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index e6378f046..5d8c8d90f 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -4319,11 +4319,15 @@ static size_t fcgi_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, /* Check if length of the body is known or if the message is - * full. Otherwise, the request is invalid. + * full. Otherwise, the request is invalid. The message is full + * if the end of the message was reached or if the trailers were + * received. In this last case, the EOM flag may be received + * later, on a NOOP block. */ sl = http_get_stline(htx); blk = htx_get_tail_blk(htx); - if (!sl || (!(sl->flags & HTX_SL_F_CLEN) && !(blk->flags & HTX_BLK_FL_EOM))) { + if (!sl || (!(sl->flags & HTX_SL_F_CLEN) && + !(blk->flags & HTX_BLK_FL_EOM) && htx_get_blk_type(blk) != HTX_BLK_EOT)) { htx->flags |= HTX_FL_PARSING_ERROR; fcgi_strm_error(fstrm); goto done;