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.
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);