]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: hq-interop: ignore uni streams in HTTP/0.9
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 16 Nov 2026 16:16:31 +0000 (17:16 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 16 Nov 2026 16:45:49 +0000 (17:45 +0100)
HTTP/0.9 only relies on bidirectional streams. To ensure there is no
undefined behavior, this is now enforced this in rcv_buf and attach
callbacks.

Along with this change, redundant checks on bidi stream types are
removed in functions used in the context of these callbacks.

This may be backported to stable releases if needed.

src/hq_interop.c

index f7918771e9d7053ebf81350c6382117f8069663b..122348570b014893a985c15308d9a2cf17794988 100644 (file)
@@ -38,7 +38,7 @@ static ssize_t hq_interop_rcv_buf_req(struct qcs *qcs, struct buffer *b, int fin
        /* hq-interop parser does not support buffer wrapping. */
        BUG_ON(b_data(b) != b_contig_data(b, 0));
 
-       if (!b_data(b) && fin && quic_stream_is_bidi(qcs->id)) {
+       if (!b_data(b) && fin) {
                if (qcs_http_handle_standalone_fin(qcs, 0))
                        return -1;
                return 0;
@@ -162,7 +162,7 @@ static ssize_t hq_interop_rcv_buf_res(struct qcs *qcs, struct buffer *b, int fin
        }
 
        if (!to_copy) {
-               if (fin && quic_stream_is_bidi(qcs->id)) {
+               if (fin) {
                        if (qcs_http_handle_standalone_fin(qcs, 0)) {
                                htx_to_buf(htx, htx_buf);
                                return -1;
@@ -214,6 +214,10 @@ static ssize_t hq_interop_rcv_buf_res(struct qcs *qcs, struct buffer *b, int fin
 /* Returns the amount of decoded bytes from <b> or a negative error code. */
 static ssize_t hq_interop_rcv_buf(struct qcs *qcs, struct buffer *b, int fin)
 {
+       /* Ignore uni streams with HTTP/0.9 */
+       if (quic_stream_is_uni(qcs->id))
+               return b_data(b);
+
        return !(qcs->qcc->flags & QC_CF_IS_BACK) ?
          hq_interop_rcv_buf_req(qcs, b, fin) :
          hq_interop_rcv_buf_res(qcs, b, fin);
@@ -404,7 +408,8 @@ static size_t hq_interop_done_ff(struct qcs *qcs)
 
 static int hq_interop_attach(struct qcs *qcs, void *conn_ctx)
 {
-       qcs_wait_http_req(qcs);
+       if (quic_stream_is_bidi(qcs->id))
+               qcs_wait_http_req(qcs);
        return 0;
 }