]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h1-htx/http-ana: Set BODYLESS flag on message in TUNNEL state
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 20 Nov 2020 13:30:38 +0000 (14:30 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Dec 2020 13:41:49 +0000 (14:41 +0100)
When a H1 message is parsed, if the parser state is switched to TUNNEL mode
just after the header parsing, the BODYLESS flag is set on the HTX
start-line. By transitivity, the corresponding flag is set on the message in
HTTP analysers.  Thus it is possible to rely on it to not wait for the
request body.

src/h1_htx.c
src/http_ana.c

index a2ee5108d39ef6dd83d008296a4fff110c2e93e3..734f9cbce7664f2cad9274531016a3fe204b7136 100644 (file)
@@ -146,6 +146,8 @@ static unsigned int h1m_htx_sl_flags(struct h1m *h1m)
                else
                        flags |= HTX_SL_F_BODYLESS;
        }
+       if (h1m->state == H1_MSG_TUNNEL)
+               flags |= HTX_SL_F_BODYLESS;
        return flags;
 }
 
index 741ec56b1be697f97d065d6a8e74611f57bd835c..5dfd41bde61cd3ee5fc3607071ffab1a7120117d 100644 (file)
@@ -875,8 +875,8 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
        if (htx->flags & HTX_FL_PROCESSING_ERROR)
                goto return_int_err;
 
-       /* CONNECT requests have no body */
-       if (txn->meth == HTTP_METH_CONNECT)
+       /* Do nothing for bodyless and CONNECT requests */
+       if (txn->meth == HTTP_METH_CONNECT || (msg->flags & HTTP_MSGF_BODYLESS))
                goto http_end;
 
        /* We have to parse the HTTP request body to find any required data.