]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http/filters: Be sure to wait if a filter loops in HTTP_MSG_ENDING
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 31 Mar 2017 13:37:29 +0000 (15:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 14 Jun 2017 14:46:21 +0000 (16:46 +0200)
A filter can choose to loop when a HTTP message is in the state
HTTP_MSG_ENDING. But the transaction is terminated with an error if the input is
closed (CF_SHUTR set on the channel). At this step, we have received all data,
so we can wait.

So now, we also check the parser state before leaving. This fix only affects
configs that use a filter that can wait in http_forward_data or http_end
callbacks, when all data were parsed.

src/proto_http.c

index a72f3021fa1fc2057ac8c84ea5e3d4d7d2103048..46cb6ffe22de0a81aa17ca41cde69be1d33db590 100644 (file)
@@ -5803,7 +5803,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
 
  missing_data_or_waiting:
        /* stop waiting for data if the input is closed before the end */
-       if (req->flags & CF_SHUTR) {
+       if (msg->msg_state < HTTP_MSG_ENDING && req->flags & CF_SHUTR) {
                if (!(s->flags & SF_ERR_MASK))
                        s->flags |= SF_ERR_CLICL;
                if (!(s->flags & SF_FINST_MASK)) {
@@ -6962,7 +6962,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
         * so we don't want to count this as a server abort. Otherwise it's a
         * server abort.
         */
-       if (res->flags & CF_SHUTR) {
+       if (msg->msg_state < HTTP_MSG_ENDING && res->flags & CF_SHUTR) {
                if ((s->req.flags & (CF_SHUTR|CF_SHUTW)) == (CF_SHUTR|CF_SHUTW))
                        goto aborted_xfer;
                /* If we have some pending data, we continue the processing */