TS-2419: Don't close client connection when responding with a 204 and there is no body
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1bcff787 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1bcff787 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1bcff787 Branch: refs/heads/5.0.x Commit: 1bcff7873b5cd701d90a00191d6646210ab9e7c3 Parents: a10b809 Author: Bryan Call <bc...@apache.org> Authored: Fri Dec 6 16:57:46 2013 -0800 Committer: Bryan Call <bc...@apache.org> Committed: Fri Dec 6 16:57:46 2013 -0800 ---------------------------------------------------------------------- proxy/http/HttpTransact.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1bcff787/proxy/http/HttpTransact.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 991e1bf..a7a14a2 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -6756,9 +6756,10 @@ HttpTransact::handle_response_keep_alive_headers(State* s, HTTPVersion ver, HTTP } else if (HTTP_MAJOR(ver.m_version) == 0) { /* No K-A for 0.9 apps */ ka_action = KA_DISABLED; } - // some systems hang until the connection closes when receiving a 204 - // regardless of the K-A headers - else if (heads->status_get() == HTTP_STATUS_NO_CONTENT) { + else if (heads->status_get() == HTTP_STATUS_NO_CONTENT && + (s->current.server->transfer_encoding != NO_TRANSFER_ENCODING || s->hdr_info.request_content_length != 0)) { + // some systems hang until the connection closes when receiving a 204 regardless of the K-A headers + // close if there is any body response from the origin ka_action = KA_CLOSE; } else { // Determine if we are going to send either a server-generated or