From: Willy Tarreau Date: Sun, 12 Dec 2010 11:50:05 +0000 (+0100) Subject: [BUG] http chunking: don't report a parsing error on connection errors X-Git-Tag: v1.5-dev8~352 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fe693b4d6c3e912688c1996a977cd4d56ed7334;p=thirdparty%2Fhaproxy.git [BUG] http chunking: don't report a parsing error on connection errors When haproxy parses chunk-encoded data that are scheduled to be sent, it is possible that the other end is closed (mainly due to a client abort returning as an error). The message state thus changes to HTTP_MSG_ERROR and the error is reported as a chunk parsing error ("PD--") while it is not. Detect this case before setting the flags and set the appropriate flag in this case. --- diff --git a/src/proto_http.c b/src/proto_http.c index 893f8da296..670ecd1180 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -4407,8 +4407,18 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit) /* some state changes occurred, maybe the analyser * was disabled too. */ - if (unlikely(msg->msg_state == HTTP_MSG_ERROR)) + if (unlikely(msg->msg_state == HTTP_MSG_ERROR)) { + if (req->flags & BF_SHUTW) { + /* request errors are most likely due to + * the server aborting the transfer. + */ + if (!(s->flags & SN_ERR_MASK)) + s->flags |= SN_ERR_SRVCL; + if (!(s->flags & SN_FINST_MASK)) + s->flags |= SN_FINST_D; + } goto return_bad_req; + } return 1; } @@ -5385,8 +5395,18 @@ int http_response_forward_body(struct session *s, struct buffer *res, int an_bit /* some state changes occurred, maybe the analyser * was disabled too. */ - if (unlikely(msg->msg_state == HTTP_MSG_ERROR)) + if (unlikely(msg->msg_state == HTTP_MSG_ERROR)) { + if (res->flags & BF_SHUTW) { + /* response errors are most likely due to + * the client aborting the transfer. + */ + if (!(s->flags & SN_ERR_MASK)) + s->flags |= SN_ERR_CLICL; + if (!(s->flags & SN_FINST_MASK)) + s->flags |= SN_FINST_D; + } goto return_bad_res; + } return 1; } return 0;