]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h3: trace HTTP headers on BE side
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 11 Jun 2026 09:20:54 +0000 (11:20 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 11 Jun 2026 09:40:06 +0000 (11:40 +0200)
Output HTTP/3 header traces on the backend side. As previous commit,
this relies on h3_trace_header() function.

Extra calls are added for fields extracted from the request start-line
which produce an HTTP/3 pseudo-header.

src/h3.c

index d5196f9ac65012874e0b6dea68a7151c79a7ed94..7b469df458b044a16877aa804d9e1efa58bb1e48 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -1237,6 +1237,13 @@ static ssize_t h3_resp_headers_to_htx(struct qcs *qcs, const struct buffer *buf,
                goto out;
        }
 
+       if ((TRACE_SOURCE)->verbosity >= H3_VERB_ADVANCED &&
+           TRACE_ENABLED(TRACE_LEVEL_USER, H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, 0, 0, 0)) {
+               int i;
+               for (i = 0; list[i].n.len; ++i)
+                       h3_trace_header(list[i].n, list[i].v, H3_EV_RX_HDR, ist(TRC_LOC), __FUNCTION__, qcs->qcc, qcs);
+       }
+
        if (!(appbuf = qcc_get_stream_rxbuf(qcs))) {
                TRACE_ERROR("buffer alloc failure", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
                len = -1;
@@ -2313,6 +2320,7 @@ static int h3_req_headers_send(struct qcs *qcs, struct htx *htx)
 
        if (qpack_encode_method(&headers_buf, sl->info.req.meth, meth))
                goto err_full;
+       h3_trace_header(ist(":method"), meth, H3_EV_TX_HDR, ist(TRC_LOC), __FUNCTION__, qcs->qcc, qcs);
 
        if (uri.ptr[0] != '/' && uri.ptr[0] != '*') {
                int len = 1;
@@ -2344,13 +2352,23 @@ static int h3_req_headers_send(struct qcs *qcs, struct htx *htx)
 
        if (qpack_encode_scheme(&headers_buf, scheme))
                goto err_full;
+       h3_trace_header(ist(":scheme"), scheme, H3_EV_TX_HDR, ist(TRC_LOC), __FUNCTION__, qcs->qcc, qcs);
 
        if (qpack_encode_path(&headers_buf, uri))
                goto err_full;
+       h3_trace_header(ist(":path"), uri, H3_EV_TX_HDR, ist(TRC_LOC), __FUNCTION__, qcs->qcc, qcs);
 
        if (istlen(auth)) {
                if (qpack_encode_auth(&headers_buf, auth))
                        goto err_full;
+               h3_trace_header(ist(":authority"), auth, H3_EV_TX_HDR, ist(TRC_LOC), __FUNCTION__, qcs->qcc, qcs);
+       }
+
+       if ((TRACE_SOURCE)->verbosity >= H3_VERB_ADVANCED &&
+           TRACE_ENABLED(TRACE_LEVEL_USER, H3_EV_TX_FRAME|H3_EV_TX_HDR, qcs->qcc->conn, 0, 0, 0)) {
+               int i;
+               for (i = 0; list[i].n.len; ++i)
+                       h3_trace_header(list[i].n, list[i].v, H3_EV_TX_HDR, ist(TRC_LOC), __FUNCTION__, qcs->qcc, qcs);
        }
 
        if (!(sl->flags & HTX_SL_F_XFER_LEN)) {