Repository: trafficserver Updated Branches: refs/heads/master 7d2d7d359 -> c350a22a0
Revert "TS-3106: Keep Alive not correctly applied to errored pages" This reverts commit 505510ede07ec8c082b9511ac1544dfe7d76320b. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c350a22a Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c350a22a Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c350a22a Branch: refs/heads/master Commit: c350a22a03f6ff68269f502537ac6c23aea38629 Parents: 7d2d7d3 Author: Brian Geffon <[email protected]> Authored: Tue Sep 30 03:20:03 2014 -0700 Committer: Brian Geffon <[email protected]> Committed: Tue Sep 30 03:20:03 2014 -0700 ---------------------------------------------------------------------- proxy/http/HttpTransact.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c350a22a/proxy/http/HttpTransact.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 47c7bb8..c5e8b2f 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -966,6 +966,8 @@ 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); @@ -1140,9 +1142,6 @@ 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 // //////////////////////////////////////////////// @@ -1305,6 +1304,11 @@ 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) @@ -7974,8 +7978,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.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."); + if (s->hdr_info.request_content_length != 0 && + s->state_machine->client_request_body_bytes < s->hdr_info.request_content_length) { s->client_info.keep_alive = HTTP_NO_KEEPALIVE; } else { // We don't have a request body. Since we are
