From: Willy Tarreau Date: Sun, 15 Dec 2013 14:32:10 +0000 (+0100) Subject: OPTIM: http: do not re-enable reading on client side while closing the server side X-Git-Tag: v1.5-dev20~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e7a1658996cc6b9c0f5f1ae56e0e5008aabd581;p=thirdparty%2Fhaproxy.git OPTIM: http: do not re-enable reading on client side while closing the server side It's common to observe a an recv() call on the client side just after the connect() to has been issued to the server side when running in server close mode. The reason is that the whole request has been sent and the shutw() has been queued in the channel, so the request message switches to the MSG_CLOSED state, which didn't disable reading. Let's do it now. That way the reading will only be re-enabled after the response is transferred to the client. However if abortonclose is set, we still leave it enabled. --- diff --git a/src/proto_http.c b/src/proto_http.c index 2fcff7186d..a459c53bca 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -4496,6 +4496,8 @@ int http_sync_req_state(struct session *s) if (txn->req.msg_state == HTTP_MSG_CLOSED) { http_msg_closed: + if (!(s->be->options & PR_O_ABRT_CLOSE)) + channel_dont_read(chn); goto wait_other_side; }