Repository: trafficserver Updated Branches: refs/heads/master 65aee4dda -> 510fe9e2b
TS-3106: Keep Alive not correctly applied to errored pages Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/505510ed Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/505510ed Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/505510ed Branch: refs/heads/master Commit: 505510ede07ec8c082b9511ac1544dfe7d76320b Parents: 65aee4d Author: Brian Geffon <[email protected]> Authored: Tue Sep 30 02:04:40 2014 -0700 Committer: Brian Geffon <[email protected]> Committed: Tue Sep 30 02:04:40 2014 -0700 ---------------------------------------------------------------------- proxy/http/HttpTransact.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/505510ed/proxy/http/HttpTransact.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index c5e8b2f..47c7bb8 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -966,8 +966,6 @@ done: otherwise, 502/404 the request right now. /eric */ if (!s->reverse_proxy && s->state_machine->plugin_tunnel_type == HTTP_NO_PLUGIN_TUNNEL) { - // TS-2879: Let's initialize the state variables so the connection can be kept alive. - initialize_state_variables_from_request(s, &s->hdr_info.client_request); DebugTxn("http_trans", "END HttpTransact::EndRemapRequest"); HTTP_INCREMENT_TRANS_STAT(http_invalid_client_requests_stat); TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL); @@ -1142,6 +1140,9 @@ HttpTransact::ModifyRequest(State* s) // Initialize the state vars necessary to sending error responses bootstrap_state_variables_from_request(s, &request); + // TS-2879: Let's initialize the state variables so the connection can be kept alive. + initialize_state_variables_from_request(s, &s->hdr_info.client_request); + //////////////////////////////////////////////// // If there is no scheme default to http // //////////////////////////////////////////////// @@ -1304,11 +1305,6 @@ HttpTransact::HandleRequest(State* s) obj_describe(s->hdr_info.client_request.m_http, 1); } - // at this point we are guaranteed that the request is good and acceptable. - // initialize some state variables from the request (client version, - // client keep-alive, cache action, etc. - initialize_state_variables_from_request(s, &s->hdr_info.client_request); - // Cache lookup or not will be decided later at DecideCacheLookup(). // Before it's decided to do a cache lookup, // assume no cache lookup and using proxy (not tunneling) @@ -7978,8 +7974,8 @@ HttpTransact::build_error_response(State *s, HTTPStatus status_code, const char // the next header (unless we've already drained // // which we do for NTLM auth) // ////////////////////////////////////////////////////// - if (s->hdr_info.request_content_length != 0 && - s->state_machine->client_request_body_bytes < s->hdr_info.request_content_length) { + if (s->hdr_info.client_request.get_content_length() != 0 || s->client_info.transfer_encoding == HttpTransact::CHUNKED_ENCODING) { + Debug("http", "Disabling KA because request had a body on error response."); s->client_info.keep_alive = HTTP_NO_KEEPALIVE; } else { // We don't have a request body. Since we are
