[ https://issues.apache.org/jira/browse/TS-3326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sudheer Vinukonda updated TS-3326: ---------------------------------- Affects Version/s: 5.2.0 Fix Version/s: 5.3.0 Assignee: Sudheer Vinukonda Patch for this issue (tested by setting {{proxy.config.http.send_http11_requests}} to both 1 (always http/11) and 2 (http/11 only if hostdb says so): {code} diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 24eab46..603b7ed 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -2669,7 +2669,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); + if (!s->stale_icp_lookup && (check_hostdb || !ats_is_ip(&s->current.server->addr))) { + DebugTxn("http_trans", "CacheOpenReadHit - doing hsotdb check"); // ink_release_assert(s->current.request_to == PARENT_PROXY || // s->http_config_param->no_dns_forward_to_parent != 0); @@ -2695,6 +2697,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); @@ -4990,6 +4993,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; +} + diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h index fd8100c..121ec7d 100644 --- a/proxy/http/HttpTransact.h +++ b/proxy/http/HttpTransact.h @@ -1295,6 +1295,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); {code} > proxy.config.http.send_http11_requests not applied when hostdb lookup is not > performed > -------------------------------------------------------------------------------------- > > Key: TS-3326 > URL: https://issues.apache.org/jira/browse/TS-3326 > Project: Traffic Server > Issue Type: Bug > Components: Core, HTTP > Affects Versions: 5.2.0 > Reporter: Sudheer Vinukonda > Assignee: Sudheer Vinukonda > Fix For: 5.3.0 > > > The setting {{proxy.config.http.send_http11_requests}} determines what http > version is used in sending outgoing requests. However, this setting is not > applied when dns/hostdb lookup is skipped (for e.g, when using the TS API > {{TSHttpTxnServerAddrSet}}). This causes problems since the default version > in the code used is v0.9 at the moment. See the jira TS-3327 that proposes to > change the default to an invalid value (e.g 0.0) in 6.0 -- This message was sent by Atlassian JIRA (v6.3.4#6332)