Repository: trafficserver Updated Branches: refs/heads/master ec85db857 -> b214740e7
[TS-3326]: proxy.config.http.send_http11_requests not applied when hostdb lookup is not performed Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/0f6f84e7 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/0f6f84e7 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/0f6f84e7 Branch: refs/heads/master Commit: 0f6f84e7b0427a3f24d65d72c82171abf49cd763 Parents: ec85db8 Author: Sudheer Vinukonda <[email protected]> Authored: Tue Jan 27 00:13:56 2015 +0000 Committer: Sudheer Vinukonda <[email protected]> Committed: Tue Jan 27 00:13:56 2015 +0000 ---------------------------------------------------------------------- proxy/http/HttpTransact.cc | 52 ++++++++++++++++++++++++++++++++++++++++- proxy/http/HttpTransact.h | 1 + 2 files changed, 52 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f6f84e7/proxy/http/HttpTransact.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 39fe64a..59056e3 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -2603,7 +2603,9 @@ HttpTransact::HandleCacheOpenReadHit(State* s) } if (server_up || s->stale_icp_lookup) { - if (!s->stale_icp_lookup && !ats_is_ip(&s->current.server->addr)) { + bool check_hostdb = get_ka_info_from_config(s, s->current.server); + DebugTxn("http_trans", "CacheOpenReadHit - check_hostdb %d", check_hostdb); + if (!s->stale_icp_lookup && (check_hostdb || !ats_is_ip(&s->current.server->addr))) { // ink_release_assert(s->current.request_to == PARENT_PROXY || // s->http_config_param->no_dns_forward_to_parent != 0); @@ -2629,6 +2631,7 @@ HttpTransact::HandleCacheOpenReadHit(State* s) } } + DebugTxn("http_trans", "CacheOpenReadHit - version %d", s->current.server->http_version.m_version); build_request(s, &s->hdr_info.client_request, &s->hdr_info.server_request, s->current.server->http_version); issue_revalidate(s); @@ -4928,6 +4931,53 @@ HttpTransact::merge_warning_header(HTTPHdr* cached_header, HTTPHdr* response_hea } } +bool +HttpTransact::get_ka_info_from_config(State *s, ConnectionAttributes *server_info) +{ + //////////////////////////////////////////////////////// + // Set the keep-alive and version flags for later use // + // in request construction // + // this is also used when opening a connection to // + // the origin server, and search_keepalive_to(). // + //////////////////////////////////////////////////////// + bool check_hostdb = false; + if (server_info->http_version != HTTPVersion(0, 9)) { + DebugTxn("http_trans", "get_ka_info_from_config, version already set server_info->http_version %d", + server_info->http_version.m_version); + return false; + } + switch (s->txn_conf->send_http11_requests) { + case HttpConfigParams::SEND_HTTP11_NEVER: + server_info->http_version = HTTPVersion(1, 0); + break; + case HttpConfigParams::SEND_HTTP11_ALWAYS: + server_info->http_version = HTTPVersion(1, 1); + break; + case HttpConfigParams::SEND_HTTP11_UPGRADE_HOSTDB: + server_info->http_version = HTTPVersion(1, 0); + check_hostdb = true; + break; + default: + ink_assert(0); + // FALL THROUGH + case HttpConfigParams::SEND_HTTP11_IF_REQUEST_11_AND_HOSTDB: + server_info->http_version = HTTPVersion(1, 0); + check_hostdb = true; + break; + } + DebugTxn("http_trans", "get_ka_info_from_config, server_info->http_version %d, check_hostdb %d", + server_info->http_version.m_version, check_hostdb); + ///////////////////////////// + // origin server keep_alive // + ///////////////////////////// + if (s->txn_conf->keep_alive_enabled_out) { + server_info->keep_alive = HTTP_KEEPALIVE; + } else { + server_info->keep_alive = HTTP_NO_KEEPALIVE; + } + return check_hostdb; +} + void HttpTransact::get_ka_info_from_host_db(State *s, ConnectionAttributes *server_info, ConnectionAttributes * /* client_info ATS_UNUSED */, HostDBInfo *host_db_info) http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f6f84e7/proxy/http/HttpTransact.h ---------------------------------------------------------------------- diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h index f30f19c..4de29e8 100644 --- a/proxy/http/HttpTransact.h +++ b/proxy/http/HttpTransact.h @@ -1296,6 +1296,7 @@ public: // Utility Methods static void issue_revalidate(State* s); + static bool get_ka_info_from_config(State* s, ConnectionAttributes* server_info); static void get_ka_info_from_host_db(State* s, ConnectionAttributes* server_info, ConnectionAttributes* client_info, HostDBInfo* host_db_info); static bool service_transaction_in_proxy_only_mode(State* s);
