]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: h3: fix error code on incomplete request
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 12 Nov 2026 14:36:05 +0000 (15:36 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 12 Nov 2026 16:31:36 +0000 (17:31 +0100)
HTTP/3 parser validates that a request has been received when FIN is
signalled by the peer on a request stream. FIN signal may be conveyed
with an extension frame. In this case, if no header was received, the
request is invalid and the stream is closed with an error.

This patch simply fixes the reported error code to H3_REQUEST_INCOMPLETE
as recommended by RFC 9114 when the issue occurs on the frontend side.
H3_MESSAGE_ERROR is kept on the backend side as there is no specific
error code defined for an incomplete response.

This must be backported up to 2.8. Ensure enum is adapted for 2.8 as the
name changed after.

src/h3.c

index 278bafccdb8357504f9d1f3e24374185b62ad47e..f93ceb433ef258f39842988db7c7929ada0429c0 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -2326,8 +2326,8 @@ static ssize_t h3_rcv_buf(struct qcs *qcs, struct buffer *b, int fin)
                        if (quic_stream_is_bidi(qcs->id) && last_stream_frame) {
                                /* No header seen, HTTP message is malformed. */
                                if (h3s->st_req == H3S_ST_REQ_BEFORE) {
-                                       TRACE_ERROR("malformed request closed by unknown frame without any header", H3_EV_RX_FRAME, qcs->qcc->conn, qcs);
-                                       h3s->err = H3_ERR_MESSAGE_ERROR;
+                                       TRACE_ERROR("incomplete request/response closed by unknown frame", H3_EV_RX_FRAME, qcs->qcc->conn, qcs);
+                                       h3s->err = !conn_is_back(qcs->qcc->conn) ? H3_ERR_REQUEST_INCOMPLETE : H3_ERR_MESSAGE_ERROR;
                                        qcc_report_glitch(qcs->qcc, 1);
                                        ret = -1;
                                        break;