]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: mux-h1: report payload parsing glitches to the session
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2026 09:54:05 +0000 (11:54 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 16 Oct 2026 17:10:27 +0000 (19:10 +0200)
Glitches detected by the H1 mux on a frontend connection are reported to the
session by h1_process(), by comparing the number of glitches before and
after parsing. But h1_process() only parses the beginning of messages. Once
the stream is created, the payload is parsed from h1_rcv_buf(), and the
glitches reported there (invalid chunk sizes, invalid chunk CRLF, invalid
trailers...) only increment the connection's counter, never the session's
one.

Now h1_rcv_buf() reports the new glitches to the session, like h1_process()
does.

This was introduced with the glitches support by commit 05b457002 ("MEDIUM:
mux-h1: implement basic glitches support") in 3.4. So this patch should be
backported to 3.4.

src/mux_h1.c

index 12eb43d89858d5add8e3e9fc9e6ef26914954ab0..1b2fb6d7e42d62f49a572f7921da89b31a4a1672 100644 (file)
@@ -4954,8 +4954,14 @@ static size_t h1_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count, in
                goto end;
        }
 
-       if (!(h1c->flags & H1C_F_IN_ALLOC))
+       if (!(h1c->flags & H1C_F_IN_ALLOC)) {
+               int prev_glitches = h1c->glitches;
+
                ret = h1_process_demux(h1c, buf, count);
+
+               if (h1c->glitches != prev_glitches && !(h1c->flags & H1C_F_IS_BACK))
+                       session_add_glitch_ctr(h1c->conn->owner, h1c->glitches - prev_glitches);
+       }
        else
                TRACE_DEVEL("h1c ibuf not allocated", H1_EV_H1C_RECV|H1_EV_H1C_BLK, h1c->conn);