From 6e1fd203db79d43a2cacb7b110431aa03879bb3a Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Fri, 11 Sep 2020 18:42:21 +0000 Subject: [PATCH 1/2] Remove obsolete cdn_ HttpTransact vars --- proxy/http/HttpTransact.cc | 25 ++++++------------------- proxy/http/HttpTransact.h | 6 ------ 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index da34f053028..aa5505a898c 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -757,15 +757,15 @@ how_to_open_connection(HttpTransact::State *s) break; } - s->cdn_saved_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN; + HttpTransact::StateMachineAction_t connect_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN; // Setting up a direct CONNECT tunnel enters OriginServerRawOpen. We always do that if we // are not forwarding CONNECT and are not going to a parent proxy. if (s->method == HTTP_WKSIDX_CONNECT) { if (s->txn_conf->forward_connect_method == 1 || s->parent_result.result == PARENT_SPECIFIED) { - s->cdn_saved_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN; + connect_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN; } else { - s->cdn_saved_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_RAW_OPEN; + connect_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_RAW_OPEN; } } @@ -774,9 +774,7 @@ how_to_open_connection(HttpTransact::State *s) HttpTransactHeaders::convert_request(s->current.server->http_version, &s->hdr_info.server_request); } - ink_assert(s->cdn_saved_next_action == HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN || - s->cdn_saved_next_action == HttpTransact::SM_ACTION_ORIGIN_SERVER_RAW_OPEN); - return s->cdn_saved_next_action; + return connect_next_action; } /***************************************************************************** @@ -2020,19 +2018,8 @@ HttpTransact::OSDNSLookup(State *s) // After SM_ACTION_DNS_LOOKUP, goto the saved action/state ORIGIN_SERVER_(RAW_)OPEN. // Should we skip the StartAccessControl()? why? - if (s->cdn_remap_complete) { - TxnDebug("cdn", "This is a late DNS lookup. We are going to the OS, " - "not to HandleFiltering."); - - ink_assert(s->cdn_saved_next_action == SM_ACTION_ORIGIN_SERVER_OPEN || - s->cdn_saved_next_action == SM_ACTION_ORIGIN_SERVER_RAW_OPEN); - TxnDebug("cdn", "outgoing version -- (pre conversion) %d", s->hdr_info.server_request.m_http->m_version); - (&s->hdr_info.server_request)->version_set(HTTPVersion(1, 1)); - HttpTransactHeaders::convert_request(s->current.server->http_version, &s->hdr_info.server_request); - TxnDebug("cdn", "outgoing version -- (post conversion) %d", s->hdr_info.server_request.m_http->m_version); - TRANSACT_RETURN(s->cdn_saved_next_action, nullptr); - } else if (DNSLookupInfo::OS_Addr::OS_ADDR_USE_CLIENT == s->dns_info.os_addr_style || - DNSLookupInfo::OS_Addr::OS_ADDR_USE_HOSTDB == s->dns_info.os_addr_style) { + if (DNSLookupInfo::OS_Addr::OS_ADDR_USE_CLIENT == s->dns_info.os_addr_style || + DNSLookupInfo::OS_Addr::OS_ADDR_USE_HOSTDB == s->dns_info.os_addr_style) { // we've come back after already trying the server to get a better address // and finished with all backtracking - return to trying the server. TRANSACT_RETURN(how_to_open_connection(s), HttpTransact::HandleResponse); diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h index df7986a4588..a3ff52e723e 100644 --- a/proxy/http/HttpTransact.h +++ b/proxy/http/HttpTransact.h @@ -702,12 +702,6 @@ class HttpTransact // able to defer some work in building the request TransactFunc_t pending_work = nullptr; - // Sandbox of Variables - StateMachineAction_t cdn_saved_next_action = SM_ACTION_UNDEFINED; - void (*cdn_saved_transact_return_point)(State *s) = nullptr; - bool cdn_remap_complete = false; - bool first_dns_lookup = true; - HttpRequestData request_data; ParentConfigParams *parent_params = nullptr; std::shared_ptr next_hop_strategy = nullptr; From 20807a6ccea09cb8b5c3c2da1adfb317ec5d754d Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Mon, 14 Sep 2020 15:34:01 +0000 Subject: [PATCH 2/2] Further reduce how_to_open_connection logic --- proxy/http/HttpTransact.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index aa5505a898c..4fdb683b936 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -762,9 +762,7 @@ how_to_open_connection(HttpTransact::State *s) // Setting up a direct CONNECT tunnel enters OriginServerRawOpen. We always do that if we // are not forwarding CONNECT and are not going to a parent proxy. if (s->method == HTTP_WKSIDX_CONNECT) { - if (s->txn_conf->forward_connect_method == 1 || s->parent_result.result == PARENT_SPECIFIED) { - connect_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN; - } else { + if (s->txn_conf->forward_connect_method != 1 && s->parent_result.result != PARENT_SPECIFIED) { connect_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_RAW_OPEN; } }