]> git.kaiwu.me - haproxy.git/commitdiff
Revert "BUG/MINOR: h3: fix missing EOM after trailers without FIN" quic-interop
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 18 Nov 2026 09:19:20 +0000 (10:19 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 18 Nov 2026 09:29:22 +0000 (10:29 +0100)
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.

include/haproxy/qcm_http.h
src/h3.c
src/hq_interop.c
src/qcm_http.c

index c72428cb8b8084dff4ed58b1c72f7d6aab547bee..85de625eb8ed33aa8c7e98271edab6071a9a9174 100644 (file)
@@ -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);
index b0e91614c17bb6784e2e7b99a6f43dffdfd80f33..464b23501d9ffd558627db3d304eba6a22c4a32f 100644 (file)
--- 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);
index dab14833a8d82e2de359df82d217f22c495c4317..01715db70f727686b52c4b8985b269a7d5d44cdc 100644 (file)
@@ -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;
                        }
index 00dd9bebef7cc0d4fb93bc79a2961170918082b3..9cbf37ba8b6ec086bb6dff494b0cca2bf484b7e2 100644 (file)
@@ -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 <qcs> instance. If <force_eot> 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 <qcs> 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;