From: Christopher Faulet Date: Tue, 15 Apr 2025 05:54:19 +0000 (+0200) Subject: BUG/MINOR: http-ana: Properly detect client abort when forwarding the response X-Git-Tag: v3.2-dev11~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c672b2a297158bcd673feab2fd366709f9fc3d4f;p=thirdparty%2Fhaproxy.git BUG/MINOR: http-ana: Properly detect client abort when forwarding the response During the response payload forwarding, if the back SC is closed, we try to figure out if it is because of a client abort or a server abort. However, the condition was not accurrate, especially when abortonclose option is set. Because of this issue, a server abort may be reported (SD-- in logs) instead of a client abort (CD-- in logs). The right way to detect a client abort when we try to forward the response is to test if the back SC was shut down (SC_FL_SHUT_DOWN flag set) AND aborted (SC_FL_ABRT_DONE flag set). When these both flags are set, it means the back connection underwent the shutdown, which should be converted to a client abort at this stage. This patch should be backported as far as 2.8. It should fix last strange SD report in the issue #2749. --- diff --git a/src/http_ana.c b/src/http_ana.c index 09a53b0f3..68db27f56 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -2215,8 +2215,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit * server abort. */ if (msg->msg_state < HTTP_MSG_ENDING && (s->scb->flags & (SC_FL_EOS|SC_FL_ABRT_DONE))) { - if ((s->scf->flags & SC_FL_ABRT_DONE) && - (s->scb->flags & SC_FL_SHUT_DONE)) + if ((s->scb->flags & (SC_FL_ABRT_DONE|SC_FL_SHUT_DONE)) == (SC_FL_ABRT_DONE|SC_FL_SHUT_DONE)) goto return_cli_abort; /* If we have some pending data, we continue the processing */ if (htx_is_empty(htx))