From: Amaury Denoyelle Date: Wed, 18 Nov 2026 09:19:20 +0000 (+0100) Subject: Revert "BUG/MINOR: h3: fix missing EOM after trailers without FIN" X-Git-Tag: v3.5-dev13~21 X-Git-Url: https://git.kaiwu.me/web/%22data:,/doc/static/%7B@url%7D?a=commitdiff_plain;h=ca167c01f1b6f6c53869869669d5b15499316183;p=haproxy.git Revert "BUG/MINOR: h3: fix missing EOM after trailers without FIN" This reverts commit 2aed0c9bea4a61c0c58a1fc89f4fa98647fe0528. This fix introduces a major regression as emitting trailers without EOT is not supported by htx_xfer(). A BUG_ON() in this function is triggered if rcv_buf runs between the trailers parsing and the FIN reception. This may reveals deeper limitation which may requires a different approach for the original issue. A revert is considered the most viable solution for now until a decision is made the most viable as the original issue is not a major one. Several conflits were fixed as code changed multiple times in H3/hq-interop due to other minor fixes introduced since the bug introuction. The faulty patch was not yet picked in stable releases as it was under observation. As such, it must now be skipped and thus this revert is only relevant for the current dev tree. --- diff --git a/include/haproxy/qcm_http.h b/include/haproxy/qcm_http.h index c72428cb8..85de625eb 100644 --- a/include/haproxy/qcm_http.h +++ b/include/haproxy/qcm_http.h @@ -9,7 +9,7 @@ size_t qcs_http_rcv_buf(struct qcs *qcs, struct buffer *buf, size_t count, char *fin); -int qcs_http_handle_standalone_fin(struct qcs *qcs, int force_eot); +int qcs_http_handle_standalone_fin(struct qcs *qcs); size_t qcs_http_snd_buf(struct qcs *qcs, struct buffer *buf, size_t count, char *fin); diff --git a/src/h3.c b/src/h3.c index b0e91614c..464b23501 100644 --- a/src/h3.c +++ b/src/h3.c @@ -1634,7 +1634,7 @@ static ssize_t h3_trailers_to_htx(struct qcs *qcs, const struct buffer *buf, goto out; } - prs_status = http_trailers_to_htx(list, fin, htx, (qcs->qcc->flags & QC_CF_IS_BACK) ? HTTP_PF_DIR_RES : 0); + prs_status = http_trailers_to_htx(list, 1, htx, (qcs->qcc->flags & QC_CF_IS_BACK) ? HTTP_PF_DIR_RES : 0); switch (prs_status) { case HTTP_PRS_SUCCESS: break; @@ -2063,7 +2063,7 @@ static ssize_t h3_rcv_buf(struct qcs *qcs, struct buffer *b, int fin) goto done; } - if (qcs_http_handle_standalone_fin(qcs, h3s->st_req == H3S_ST_REQ_TRAILERS)) { + if (qcs_http_handle_standalone_fin(qcs)) { TRACE_ERROR("cannot set EOM", H3_EV_RX_FRAME, qcs->qcc->conn, qcs); qcc_set_error(qcs->qcc, H3_ERR_INTERNAL_ERROR, 1, muxc_tevt_type_internal_err); @@ -2358,7 +2358,7 @@ static ssize_t h3_rcv_buf(struct qcs *qcs, struct buffer *b, int fin) } /* Reuse wrapper function to easily set EOM on HTX message. */ - if (qcs_http_handle_standalone_fin(qcs, h3s->st_req == H3S_ST_REQ_TRAILERS)) { + if (qcs_http_handle_standalone_fin(qcs)) { TRACE_ERROR("cannot set EOM", H3_EV_RX_FRAME, qcs->qcc->conn, qcs); qcc_set_error(qcs->qcc, H3_ERR_INTERNAL_ERROR, 1, muxc_tevt_type_internal_err); diff --git a/src/hq_interop.c b/src/hq_interop.c index dab14833a..01715db70 100644 --- a/src/hq_interop.c +++ b/src/hq_interop.c @@ -42,7 +42,7 @@ static ssize_t hq_interop_rcv_buf_req(struct qcs *qcs, struct buffer *b, int fin /* Drain any data after the request and handle FIN if present, * including the case where it is set without any payload. */ - if (fin && qcs_http_handle_standalone_fin(qcs, 0)) + if (fin && qcs_http_handle_standalone_fin(qcs)) return -1; return data; } @@ -166,7 +166,7 @@ static ssize_t hq_interop_rcv_buf_res(struct qcs *qcs, struct buffer *b, int fin if (!to_copy) { if (fin) { - if (qcs_http_handle_standalone_fin(qcs, 0)) { + if (qcs_http_handle_standalone_fin(qcs)) { htx_to_buf(htx, htx_buf); return -1; } diff --git a/src/qcm_http.c b/src/qcm_http.c index 00dd9bebe..9cbf37ba8 100644 --- a/src/qcm_http.c +++ b/src/qcm_http.c @@ -61,13 +61,10 @@ size_t qcs_http_rcv_buf(struct qcs *qcs, struct buffer *buf, size_t count, return ret; } -/* Add EOM flag on input buffer for instance. If is set, EOT - * is manually inserted. This is necessary if HTX message contains not yet - * finalized trailers blocks. - * +/* Add EOM flag on input buffer for instance. * Returns 0 on success else non zero on internal error. */ -int qcs_http_handle_standalone_fin(struct qcs *qcs, int force_eot) +int qcs_http_handle_standalone_fin(struct qcs *qcs) { struct buffer *appbuf; struct htx *htx = NULL; @@ -76,9 +73,6 @@ int qcs_http_handle_standalone_fin(struct qcs *qcs, int force_eot) goto err; htx = htx_from_buf(appbuf); - if (force_eot && !htx_add_endof(htx, HTX_BLK_EOT)) - goto err; - if (!htx_set_eom(htx)) goto err;