From: Christopher Faulet Date: Fri, 31 Mar 2017 13:37:29 +0000 (+0200) Subject: BUG/MINOR: http/filters: Be sure to wait if a filter loops in HTTP_MSG_ENDING X-Git-Tag: v1.8-dev3~290 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a33510b215b9886d95360f2d60e558a8c2a57ec2;p=thirdparty%2Fhaproxy.git BUG/MINOR: http/filters: Be sure to wait if a filter loops in HTTP_MSG_ENDING 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. --- diff --git a/src/proto_http.c b/src/proto_http.c index a72f3021fa..46cb6ffe22 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -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 */