]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: h3: only increment frame type counter on new header
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 3 Sep 2026 15:55:47 +0000 (17:55 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 8 Sep 2026 13:02:29 +0000 (15:02 +0200)
For every new HTTP/3 received frame, a counter related to the frame type
is incremented. This operation is performed directly in h3_rcv_buf()
parsing loop.

Prior to this patch, increment would be called too many times when
dealing with large frames. Fix this by ensuring that the increment is
only reported once per frame. This is now performed directly after
HTTP/3 frame header parsing.

This must be backported up to 2.6.

src/h3.c

index 01f723bda50ec203b0fb57251cfc04202530b608..69cc9e530a4416e3dd8e666c318e5e6bb3c93284 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -1992,6 +1992,7 @@ static ssize_t h3_rcv_buf(struct qcs *qcs, struct buffer *b, int fin)
                        h3s->demux_frame_len = flen;
                        total += hlen;
                        TRACE_PROTO("parsing a new frame", H3_EV_RX_FRAME, qcs->qcc->conn, qcs);
+                       h3_inc_frame_type_cnt(h3c->prx_counters, ftype);
 
                        if ((ret = h3_check_frame_valid(h3c, qcs, ftype))) {
                                TRACE_ERROR("received an invalid frame", H3_EV_RX_FRAME, qcs->qcc->conn, qcs);
@@ -2074,7 +2075,6 @@ static ssize_t h3_rcv_buf(struct qcs *qcs, struct buffer *b, int fin)
                if (last_stream_frame && h3s->flags & H3_SF_HAVE_CLEN && h3_check_body_size(qcs, last_stream_frame))
                        break;
 
-               h3_inc_frame_type_cnt(h3c->prx_counters, ftype);
                switch (ftype) {
                case H3_FT_DATA:
                        ret = h3_data_to_htx(qcs, b, flen, last_stream_frame);