From: Olivier Houchard Date: Thu, 19 Nov 2026 15:45:45 +0000 (+0100) Subject: BUG/MINOR: h3: reject interim responses ending the stream X-Git-Url: https://git.kaiwu.me/http/%22data:,//%22?a=commitdiff_plain;h=9c3a95c2c6485e46aeafd9a6a9975d5d00a14c1a;p=haproxy.git BUG/MINOR: h3: reject interim responses ending the stream On the backend side, a HEADERS frame carrying a 1xx status with the FIN bit is converted into an interim response ending the message with the EOM flag, which the H1 and H2 muxes never do. The stream forwards it as an interim response and the client then gets a 502 once the end of the stream is reported, while such a response is malformed since a final response must follow an interim one. Let's reject it as a malformed response with H3_ERR_MESSAGE_ERROR, as the H2 mux does with an END_STREAM flag on a 1xx response, so the client only gets a 502. This was introduced with the backend side support by commit f79effa30 ("MINOR: h3: convert HTTP/3 response into HTX for backend side support") in 3.3-dev2, so it must be backported to 3.3. --- diff --git a/src/h3.c b/src/h3.c index 514a1c1c8..49e847a91 100644 --- a/src/h3.c +++ b/src/h3.c @@ -1422,6 +1422,15 @@ static ssize_t h3_resp_headers_to_htx(struct qcs *qcs, const struct buffer *buf, goto out; } + /* a final response must follow an interim one */ + if (h == 1 && fin) { + TRACE_ERROR("interim response ending the stream", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs); + h3s->err = H3_ERR_MESSAGE_ERROR; + qcc_report_glitch(qcs->qcc, 1); + len = -1; + goto out; + } + sl = htx_add_stline(htx, HTX_BLK_RES_SL, flags, ist("HTTP/3.0"), status, ist("")); if (!sl) { TRACE_ERROR("cannot allocate HTX start-line", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);