From: Willy Tarreau Date: Wed, 25 Nov 2015 19:11:11 +0000 (+0100) Subject: BUG/MEDIUM: http: don't enable auto-close on the response side X-Git-Tag: v1.7-dev1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=714ea78c9a09fe6a35a1f2d86af8f7fc9abb64d1;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: http: don't enable auto-close on the response side There is a bug where "option http-keep-alive" doesn't force a response to stay in keep-alive if the server sends the FIN along with the response on the second or subsequent response. The reason is that the auto-close was forced enabled when recycling the HTTP transaction and it's never disabled along the response processing chain before the SHUTR gets a chance to be forwarded to the client side. The MSG_DONE state of the HTTP response properly disables it but too late. There's no more reason for enabling auto-close here, because either it doesn't matter in non-keep-alive modes because the connection is closed, or it is automatically enabled by process_stream() when it sees there's no analyser on the stream. This bug also affects 1.5 so a backport is desired. --- diff --git a/src/proto_http.c b/src/proto_http.c index 77a52078d0..67e482fea7 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -5272,11 +5272,13 @@ void http_end_txn_clean_session(struct stream *s) s->res.flags |= CF_EXPECT_MORE; } - /* we're removing the analysers, we MUST re-enable events detection */ + /* we're removing the analysers, we MUST re-enable events detection. + * We don't enable close on the response channel since it's either + * already closed, or in keep-alive with an idle connection handler. + */ channel_auto_read(&s->req); channel_auto_close(&s->req); channel_auto_read(&s->res); - channel_auto_close(&s->res); /* we're in keep-alive with an idle connection, monitor it if not already done */ if (srv_conn && LIST_ISEMPTY(&srv_conn->list)) {