]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: Set known input payload length during demux
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 18 Sep 2025 06:29:05 +0000 (08:29 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 8 Oct 2025 09:01:36 +0000 (11:01 +0200)
Set <kip> value during the message parsing. The difference between the body
length before and after a parsing loop is added. The patch relies on the
previous one ("MINOR: h1-htx: Increment body len when parsing a payload with
no xfer length").

src/mux_h1.c

index c3c512d89ad3f3056c890dc9587abb92af8df5f8..df248a460f2883d698441017d311e2c054314ae7 100644 (file)
@@ -2128,11 +2128,13 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
        size_t data;
        size_t ret = 0;
        size_t total = 0;
+       uint64_t prev_body_len;
 
        htx = htx_from_buf(buf);
        TRACE_ENTER(H1_EV_RX_DATA, h1c->conn, h1s, htx, (size_t[]){count});
 
        h1m = (!(h1c->flags & H1C_F_IS_BACK) ? &h1s->req : &h1s->res);
+       prev_body_len = h1m->body_len;
        data = htx->data;
 
        if (h1s->flags & H1S_F_DEMUX_ERROR)
@@ -2257,6 +2259,7 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
        }
 
        b_del(&h1c->ibuf, total);
+       h1s->sd->kip += (h1m->body_len - prev_body_len);
 
        TRACE_DEVEL("incoming data parsed", H1_EV_RX_DATA, h1c->conn, h1s, htx, (size_t[]){ret});