]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: hq-interop: properly handle incomplete request
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 27 Feb 2025 10:34:39 +0000 (11:34 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 27 Feb 2025 16:34:06 +0000 (17:34 +0100)
Extends HTTP/0.9 layer to be able to deal with incomplete requests.
Instead of an error, 0 is returned. Thus, instead of a stream closure.
QUIC-MUX may retry rcv_buf operation later if more data is received,
similarly to HTTP/3 layer.

Note that HTTP/0.9 is only used for testing and interop purpose. As
such, this limitation is not considered as a bug. It is probably not
worth to backport it.

src/hq_interop.c

index 1d7821fec9571c47b271da8361146bc37a8800d6..caf45656bcf0fe8ff625953b861d8e14b7aadcfa 100644 (file)
@@ -23,10 +23,6 @@ static ssize_t hq_interop_rcv_buf(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));
 
-       /* hq-interop parser is only done once full message is received. */
-       if (!fin)
-               return 0;
-
        b_alloc(&htx_buf, DB_MUX_RX);
        htx = htx_from_buf(&htx_buf);
 
@@ -38,13 +34,13 @@ static ssize_t hq_interop_rcv_buf(struct qcs *qcs, struct buffer *b, int fin)
 
        if (!data || !HTTP_IS_SPHT(*ptr)) {
                fprintf(stderr, "truncated stream\n");
-               return -1;
+               return 0;
        }
 
        ptr++;
        if (!--data) {
                fprintf(stderr, "truncated stream\n");
-               return -1;
+               return 0;
        }
 
        if (HTTP_IS_LWS(*ptr)) {
@@ -61,7 +57,7 @@ static ssize_t hq_interop_rcv_buf(struct qcs *qcs, struct buffer *b, int fin)
 
        if (!data) {
                fprintf(stderr, "truncated stream\n");
-               return -1;
+               return 0;
        }
 
        path.len = ptr - path.ptr;