From: Olivier Houchard Date: Wed, 2 Dec 2026 13:47:18 +0000 (+0100) Subject: BUG/MEDIUM: mux-h1: accept a late EOM on content-length messages X-Git-Tag: v3.5.0~13 X-Git-Url: https://git.kaiwu.me/web/ngx_http_fastcgi_module.html?a=commitdiff_plain;h=bf2aeea3fdf5b8c4e42fd47ef1e5e8fe1333c2ee;p=haproxy.git BUG/MEDIUM: mux-h1: accept a late EOM on content-length messages When the last bytes of a message with a content-length are sent by the zero-copy path of h1_make_data() or by h1_done_ff() before the EOM is known, the message is switched to H1_MSG_TRAILERS. If the EOM then comes alone on a NOOP block, h1_make_trailers() reports a processing error. This happens when an H2 peer sends END_STREAM in a separate empty DATA frame after the payload was already forwarded, e.g. a node client piping a stream into a request with a content-length: the client gets a 500 with "IH--" although the server received the whole request. With an H2 server doing the same, the response is logged with "ID--" and the client connection is not kept alive. Let's end the message when a NOOP block carrying the EOM is found in h1_make_trailers() and the message is not chunked. It remains an error for chunked messages, for which the EOM is expected on the EOT block. This was brought in 3.5-dev14 by commit e99253b70 ("BUG/MINOR: mux-h1: properly handle NOOP blocks and track EOM emission"), so no backport is needed. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index 582872e37..c8ee5b011 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -3632,9 +3632,13 @@ static size_t h1_make_trailers(struct h1s *h1s, struct h1m *h1m, struct htx *htx h1s->flags |= H1S_F_EOM_SENT; } else if (type == HTX_BLK_NOOP) { - /* Consume the NOOP block, nothing is emitted. But EOM is unexpected before EOT */ - if (blk->flags & HTX_BLK_FL_EOM) - goto error; + /* Consume the NOOP block, nothing is emitted. EOM is unexpected for chunked messages */ + if (blk->flags & HTX_BLK_FL_EOM) { + if (h1m->flags & H1_MF_CHNK) + goto error; + h1m->state = H1_MSG_DONE; + h1s->flags |= H1S_F_EOM_SENT; + } } nextblk: