Repository: trafficserver Updated Branches: refs/heads/master ed421b87d -> 00c9bb41b
TS-2739: ATS doesn't send back Transfer-Encoding when client keep-alive is turned off Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/00c9bb41 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/00c9bb41 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/00c9bb41 Branch: refs/heads/master Commit: 00c9bb41bd19a3792735c10010c6fda7fa857786 Parents: ed421b8 Author: Wei Sun <[email protected]> Authored: Tue May 20 15:20:45 2014 -0700 Committer: Bryan Call <[email protected]> Committed: Tue May 20 15:20:45 2014 -0700 ---------------------------------------------------------------------- proxy/http/HttpTransact.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/00c9bb41/proxy/http/HttpTransact.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 732ed4d..4fcee20 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -7008,9 +7008,7 @@ HttpTransact::handle_response_keep_alive_headers(State* s, HTTPVersion ver, HTTP } // Check pre-conditions for keep-alive - if (s->client_info.keep_alive != HTTP_KEEPALIVE) { - ka_action = KA_DISABLED; - } else if (HTTP_MAJOR(ver.m_version) == 0) { /* No K-A for 0.9 apps */ + if (HTTP_MAJOR(ver.m_version) == 0) { /* No K-A for 0.9 apps */ ka_action = KA_DISABLED; } else if (heads->status_get() == HTTP_STATUS_NO_CONTENT && @@ -7059,10 +7057,13 @@ HttpTransact::handle_response_keep_alive_headers(State* s, HTTPVersion ver, HTTP heads->field_delete(MIME_FIELD_CONTENT_LENGTH, MIME_LEN_CONTENT_LENGTH); } - // If we cannot trust the content length, we will close the connection + // Close the connection if client_info is not keep-alive. + // Otherwise, if we cannot trust the content length, we will close the connection // unless we are going to use chunked encoding or the client issued // a PUSH request - if (s->hdr_info.trust_response_cl == false && + if (s->client_info.keep_alive != HTTP_KEEPALIVE) { + ka_action = KA_DISABLED; + } else if (s->hdr_info.trust_response_cl == false && !(s->client_info.receive_chunked_response == true || (s->method == HTTP_WKSIDX_PUSH && s->client_info.keep_alive == HTTP_KEEPALIVE))) { ka_action = KA_CLOSE;
