MCPcopy Create free account
hub / github.com/apache/trafficserver / do_http_server_open

Method do_http_server_open

src/proxy/http/HttpSM.cc:5363–5767  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////// HttpSM::do_http_server_open() /////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

5361//
5362//////////////////////////////////////////////////////////////////////////
5363void
5364HttpSM::do_http_server_open(bool raw, bool only_direct)
5365{
5366 int ip_family = t_state.current.server->dst_addr.sa.sa_family;
5367 auto fam_name = ats_ip_family_name(ip_family);
5368 SMDbg(dbg_ctl_http_track, "[%.*s]", static_cast<int>(fam_name.size()), fam_name.data());
5369
5370 NetVConnection *vc = _ua.get_txn()->get_netvc();
5371 ink_release_assert(vc && vc->thread == this_ethread());
5372 pending_action = nullptr;
5373
5374 // Clean up connection tracking info if any. Need to do it now so the selected group
5375 // is consistent with the actual upstream in case of retry.
5376 t_state.outbound_conn_track_state.clear();
5377
5378 // Make sure any previous attempts are cleaned out
5379 if (server_txn) {
5380 tunnel.reset();
5381 server_txn->transaction_done();
5382 server_txn = nullptr;
5383 }
5384
5385 // _ua.get_entry() can be null if a scheduled update is also a reverse proxy
5386 // request. Added REVPROXY to the assert below, and then changed checks
5387 // to be based on _ua.get_txn() != NULL instead of req_flavor value.
5388 ink_assert(_ua.get_entry() != nullptr || t_state.req_flavor == HttpTransact::REQ_FLAVOR_SCHEDULED_UPDATE ||
5389 t_state.req_flavor == HttpTransact::REQ_FLAVOR_REVPROXY);
5390
5391 ink_assert(pending_action.empty());
5392 ink_assert(t_state.current.server->dst_addr.network_order_port() != 0);
5393
5394 char addrbuf[INET6_ADDRPORTSTRLEN];
5395 SMDbg(dbg_ctl_http, "open connection to %s: %s", t_state.current.server->name,
5396 ats_ip_nptop(&t_state.current.server->dst_addr.sa, addrbuf, sizeof(addrbuf)));
5397
5398 SMDbg(dbg_ctl_http_seq, "Sending request to server");
5399
5400 // set the server first connect milestone here in case we return in the plugin_tunnel case that follows
5401 ATS_PROBE1(milestone_server_connect, sm_id);
5402 milestones[TS_MILESTONE_SERVER_CONNECT] = ink_get_hrtime();
5403 if (milestones[TS_MILESTONE_SERVER_FIRST_CONNECT] == 0) {
5404 ATS_PROBE1(milestone_server_first_connect, sm_id);
5405 milestones[TS_MILESTONE_SERVER_FIRST_CONNECT] = milestones[TS_MILESTONE_SERVER_CONNECT];
5406 }
5407
5408 if (plugin_tunnel) {
5409 PluginVCCore *t = plugin_tunnel;
5410 plugin_tunnel = nullptr;
5411 Action *pvc_action_handle = t->connect_re(this);
5412
5413 // This connect call is always reentrant
5414 ink_release_assert(pvc_action_handle == ACTION_RESULT_DONE);
5415 return;
5416 }
5417
5418 // Check for remap rule. If so, only apply ip_allow filter if it is activated (ip_allow_check_enabled_p set).
5419 // Otherwise, if no remap rule is defined, apply the ip_allow filter.
5420 if (!t_state.url_remap_success || t_state.url_map.getMapping()->ip_allow_check_enabled_p) {

Callers

nothing calls this directly

Calls 15

create_server_txnMethod · 0.95
origin_multiplexedMethod · 0.95
get_outbound_sniMethod · 0.95
get_outbound_certMethod · 0.95
ats_ip_family_nameFunction · 0.85
this_ethreadFunction · 0.85
ink_get_hrtimeFunction · 0.85
is_privateFunction · 0.85
incrementFunction · 0.85
ats_ip_addr_port_eqFunction · 0.85
set_tls_optionsFunction · 0.85

Tested by

no test coverage detected