[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.
This commit is contained in:
Willy Tarreau 2010-12-12 12:50:05 +01:00
parent 078272e115
commit 3fe693b4d6

View File

@ -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;