]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h2: add missing traces on failed headers decoding
authorWilly Tarreau <w@1wt.eu>
Thu, 19 Jan 2023 22:58:11 +0000 (23:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jan 2023 23:02:21 +0000 (00:02 +0100)
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

index 2a5d9e41a80abb38696a9a161f3135696dc2f732..16ed74305b765a531fe53afb32afefdbce85e944 100644 (file)
@@ -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 */