[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 893f8da..670ecd1 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -4407,8 +4407,18 @@
/* 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 @@
/* 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;