]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http-ana: Only set CF_EXPECT_MORE flag on data filtering
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 22 Jul 2020 14:34:59 +0000 (16:34 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 22 Jul 2020 14:46:37 +0000 (16:46 +0200)
This flag is set by HTTP analyzers to notify that more data are epxected. It is
used to know if the CO_SFL_MSG_MORE flag must be set on the connection when data
are sent. Historically, it was set on chuncked messages and on compressed
responses. But in HTX, the chunked messages are parsed by the H1 multipexer. So
for this case, the infinite forwarding is enabled and the flag must no longer be
set. For the compression, the test must be extended and be applied on all data
filters. Thus it is also true for the request channel.

So, now, CF_EXPECT_MORE flag is set on a request or a response channel if there
is at least one data filter attached to the stream. In addition, the flag is
removed when the HTTP message analysis is finished.

This patch should partially fix the issue #756. It must be backported to 2.1.

src/http_ana.c

index 7c1a1a164bbd751dae7e4508316fc9558614b528..ae7d822a1a06568e96f099b46987884bd39a87f1 100644 (file)
@@ -1246,6 +1246,8 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
        msg->msg_state = HTTP_MSG_ENDING;
 
   ending:
+       req->flags &= ~CF_EXPECT_MORE; /* no more data are expected */
+
        /* other states, ENDING...TUNNEL */
        if (msg->msg_state >= HTTP_MSG_DONE)
                goto done;
@@ -1336,7 +1338,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
         * flag with the last block of forwarded data, which would cause an
         * additional delay to be observed by the receiver.
         */
-       if (msg->flags & HTTP_MSGF_TE_CHNK)
+       if (HAS_REQ_DATA_FILTERS(s))
                req->flags |= CF_EXPECT_MORE;
 
        DBG_TRACE_DEVEL("waiting for more data to forward",
@@ -2335,6 +2337,8 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
        msg->msg_state = HTTP_MSG_ENDING;
 
   ending:
+       res->flags &= ~CF_EXPECT_MORE; /* no more data are expected */
+
        /* other states, ENDING...TUNNEL */
        if (msg->msg_state >= HTTP_MSG_DONE)
                goto done;
@@ -2414,7 +2418,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
         * flag with the last block of forwarded data, which would cause an
         * additional delay to be observed by the receiver.
         */
-       if ((msg->flags & HTTP_MSGF_TE_CHNK) || (msg->flags & HTTP_MSGF_COMPRESSING))
+       if (HAS_RSP_DATA_FILTERS(s))
                res->flags |= CF_EXPECT_MORE;
 
        /* the stream handler will take care of timeouts and errors */