From: Willy Tarreau Date: Wed, 10 Dec 2025 14:56:34 +0000 (+0100) Subject: MINOR: h2/trace: emit a trace of the received RST_STREAM type X-Git-Tag: v3.4-dev1~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ec5818807379b56db489173f2a2b24212dd31d8;p=thirdparty%2Fhaproxy.git MINOR: h2/trace: emit a trace of the received RST_STREAM type Right now we don't get any state trace when receiving an RST_STREAM, and this is not convenient because RST_STREAM(0) is not visible at all, except in developer level because the function is entered and left. Let's extract the RST code first and always log it using TRACE_PRINTF() (along with h2c/h2s) so that it's possible to detect certain codes being used. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index 39119ce4f..61ee41848 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -3356,6 +3356,8 @@ static int h2c_handle_priority(struct h2c *h2c) */ static int h2c_handle_rst_stream(struct h2c *h2c, struct h2s *h2s) { + int rst_code; + TRACE_ENTER(H2_EV_RX_FRAME|H2_EV_RX_RST|H2_EV_RX_EOI, h2c->conn, h2s); /* process full frame only */ @@ -3365,13 +3367,20 @@ static int h2c_handle_rst_stream(struct h2c *h2c, struct h2s *h2s) return 0; } + rst_code = h2_get_n32(&h2c->dbuf, 0); + TRACE_PRINTF(TRACE_LEVEL_STATE, ~0U/*H2_EV_RX_FRAME|H2_EV_RX_RST|H2_EV_RX_EOI*/, h2c->conn, h2s, 0, 0, + "received RST_STREAM(%d) : h2c=%p(%c=%s,%s,%#x) h2s=%p(%d)", + rst_code, h2c, conn_is_back(h2c->conn) ? 'B' : 'F', + h2c->proxy->id, h2c_st_to_str(h2c->st0), h2c->flags, + h2s, h2s->id); + /* late RST, already handled */ if (h2s->st == H2_SS_CLOSED) { TRACE_DEVEL("leaving on stream closed", H2_EV_RX_FRAME|H2_EV_RX_RST|H2_EV_RX_EOI, h2c->conn, h2s); return 1; } - h2s->errcode = h2_get_n32(&h2c->dbuf, 0); + h2s->errcode = rst_code; h2s_close(h2s); if (h2s_sc(h2s)) {