]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: hq-interop: trace HTX headers quic-interop
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 30 Jun 2026 08:38:52 +0000 (10:38 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 30 Jun 2026 08:40:50 +0000 (10:40 +0200)
Similar to the previous patch, complete HTTP/0.9 user traces by logging
received HTX headers on request (BE side) or response (FE). This is only
for debugging purpose : the final HTTP/0.9 content does not contain any
of these.

src/hq_interop.c

index fc9a90ec4500c9f5af475d8e1ade182b77df2d87..50c6791d8547f26aa4c47954be4e5ed47d1abb2f 100644 (file)
@@ -21,6 +21,10 @@ static void hq_trace_resp(struct ist status, uint64_t mask,
                           const struct ist trc_loc, const char *func,
                           struct qcs *qcs, struct qcc *qcc);
 
+static void hq_trace_hdr(struct ist name, struct ist value, uint64_t mask,
+                         const struct ist trc_loc, const char *func,
+                         struct qcs *qcs, struct qcc *qcc);
+
 /* HTTP/0.9 request -> HTX. */
 static ssize_t hq_interop_rcv_buf_req(struct qcs *qcs, struct buffer *b, int fin)
 {
@@ -335,6 +339,11 @@ static size_t hq_interop_snd_buf(struct qcs *qcs, struct buffer *buf,
                        count -= bsize;
                        break;
 
+               case HTX_BLK_HDR:
+                       hq_trace_hdr(htx_get_blk_name(htx, blk),
+                                    htx_get_blk_value(htx, blk),
+                                    QMUX_EV_STRM_SEND, ist(TRC_LOC), __FUNCTION__, qcs, qcs->qcc);
+                       __fallthrough;
                case HTX_BLK_TLR:
                case HTX_BLK_EOT:
                default:
@@ -472,6 +481,23 @@ static void hq_trace_resp(struct ist status, uint64_t mask,
        }
 }
 
+static void hq_trace_hdr(struct ist name, struct ist value, uint64_t mask,
+                         const struct ist trc_loc, const char *func,
+                         struct qcs *qcs, struct qcc *qcc)
+{
+       const char *line __maybe_unused;
+
+       if (TRACE_ENABLED(TRACE_LEVEL_USER, mask, qcs->qcc->conn, qcs, 0, 0)) {
+               chunk_reset(&trash);
+               line = chunk_newstr(&trash);
+               chunk_appendf(&trash, "HTTP/0.9 (%.*s: %.*s)",
+                             (uint)istlen(name), istptr(name),
+                             (uint)istlen(value), istptr(value));
+
+               _hq_trace_http(line, mask, trc_loc, func, qcs, qcc);
+       }
+}
+
 const struct qcc_app_ops hq_interop_ops = {
        .alpn       = "hq-interop",