From 17c630b84628258900268aaa5d597800fbc9adbb Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 19 Jan 2023 23:58:11 +0100 Subject: [PATCH] BUG/MINOR: mux-h2: add missing traces on failed headers decoding In case HPACK cannot be decoded, logs are emitted but there's no info in the H2 traces, so let's add them. This may be backported to all supported versions. --- src/mux_h2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mux_h2.c b/src/mux_h2.c index 2a5d9e4..16ed743 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -2585,6 +2585,7 @@ static struct h2s *h2c_frt_handle_headers(struct h2c *h2c, struct h2s *h2s) error = h2c_decode_headers(h2c, &h2s->rxbuf, &h2s->flags, &body_len, NULL); /* unrecoverable error ? */ if (h2c->st0 >= H2_CS_ERROR) { + TRACE_USER("Unrecoverable error decoding H2 trailers", H2_EV_RX_FRAME|H2_EV_RX_HDR|H2_EV_STRM_NEW|H2_EV_STRM_END, h2c->conn, 0, &rxbuf); sess_log(h2c->conn->owner); goto out; } @@ -2602,6 +2603,7 @@ static struct h2s *h2c_frt_handle_headers(struct h2c *h2c, struct h2s *h2s) */ sess_log(h2c->conn->owner); h2s_error(h2s, H2_ERR_INTERNAL_ERROR); + TRACE_USER("Stream error decoding H2 trailers", H2_EV_RX_FRAME|H2_EV_RX_HDR|H2_EV_STRM_NEW|H2_EV_STRM_END, h2c->conn, 0, &rxbuf); h2c->st0 = H2_CS_FRAME_E; goto out; } @@ -2630,6 +2632,7 @@ static struct h2s *h2c_frt_handle_headers(struct h2c *h2c, struct h2s *h2s) /* unrecoverable error ? */ if (h2c->st0 >= H2_CS_ERROR) { + TRACE_USER("Unrecoverable error decoding H2 request", H2_EV_RX_FRAME|H2_EV_RX_HDR|H2_EV_STRM_NEW|H2_EV_STRM_END, h2c->conn, 0, &rxbuf); sess_log(h2c->conn->owner); goto out; } @@ -2747,8 +2750,10 @@ static struct h2s *h2c_bck_handle_headers(struct h2c *h2c, struct h2s *h2s) } /* unrecoverable error ? */ - if (h2c->st0 >= H2_CS_ERROR) + if (h2c->st0 >= H2_CS_ERROR) { + TRACE_USER("Unrecoverable error decoding H2 HEADERS", H2_EV_RX_FRAME|H2_EV_RX_HDR, h2c->conn, h2s); goto fail; + } if (h2s->st != H2_SS_OPEN && h2s->st != H2_SS_HLOC) { /* RFC7540#5.1 */ -- 1.7.10.4