]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: http-ana: handle read error on server side if waiting for response
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 27 Apr 2021 08:56:28 +0000 (10:56 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 28 Apr 2021 08:51:08 +0000 (10:51 +0200)
A read error on the server side is also reported as a write error on the
client side. It means some times, a server side error is handled on the
client side. Among others, it is the case when the client side is waiting
for the response while the request processing is already finished. In this
case, the error is not handled as a server error. It is not accurate.

So now, when the request processing is finished but not the response
processing and if a read error was encountered on the server side, the error
is not immediatly processed on the client side, to let a chance to response
analysers to properly catch the error.

src/http_ana.c

index 77d6d1b1292dd27b919e9907c1fb2a4ad393afc1..f662a31b9de76854e217837f65bceb90372fa0ab 100644 (file)
@@ -1013,7 +1013,13 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
            ((req->flags & CF_SHUTW) && (req->to_forward || co_data(req)))) {
                /* Output closed while we were sending data. We must abort and
                 * wake the other side up.
+                *
+                * If we have finished to send the request and the response is
+                * still in progress, don't catch write error on the request
+                * side if it is in fact a read error on the server side.
                 */
+               if (msg->msg_state == HTTP_MSG_DONE && (s->res.flags & CF_READ_ERROR) && s->res.analysers)
+                       return 0;
 
                /* Don't abort yet if we had L7 retries activated and it
                 * was a write error, we may recover.