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

Method setup_plugin_request_intercept

src/proxy/http/HttpTransact.cc:1688–1725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1686}
1687
1688void
1689HttpTransact::setup_plugin_request_intercept(State *s)
1690{
1691 ink_assert(s->state_machine->plugin_tunnel != nullptr);
1692
1693 // Plugin is intercepting the request which means
1694 // that we don't do dns, cache read or cache write
1695 //
1696 // We just want to write the request straight to the plugin
1697 if (s->cache_info.action != HttpTransact::CACHE_DO_NO_ACTION) {
1698 s->cache_info.action = HttpTransact::CACHE_DO_NO_ACTION;
1699 s->current.mode = TUNNELLING_PROXY;
1700 Metrics::Counter::increment(http_rsb.tunnels);
1701 }
1702 // Regardless of the protocol we're gatewaying to
1703 // we see the scheme as http
1704 s->scheme = s->next_hop_scheme = URL_WKSIDX_HTTP;
1705
1706 // Set up a "fake" server entry
1707 update_current_info(&s->current, &s->server_info, ResolveInfo::ORIGIN_SERVER, true);
1708
1709 // Also "fake" the info we'd normally get from
1710 // hostDB
1711 s->server_info.http_version = HTTP_1_0;
1712 s->server_info.keep_alive = HTTP_NO_KEEPALIVE;
1713 s->server_info.http_version = HTTP_1_0;
1714 s->server_info.dst_addr.setToAnyAddr(AF_INET); // must set an address or we can't set the port.
1715 s->server_info.dst_addr.network_order_port() = htons(s->hdr_info.client_request.port_get()); // this is the info that matters.
1716
1717 // Build the request to the server
1718 build_request(s, &s->hdr_info.client_request, &s->hdr_info.server_request, s->client_info.http_version);
1719
1720 // We don't do keep alive over these impersonated
1721 // NetVCs so nuke the connection header
1722 s->hdr_info.server_request.field_delete(MIME_FIELD_CONNECTION, MIME_LEN_CONNECTION);
1723
1724 TRANSACT_RETURN(SM_ACTION_ORIGIN_SERVER_OPEN, nullptr);
1725}
1726
1727////////////////////////////////////////////////////////////////////////
1728// void HttpTransact::HandleApiErrorJump(State* s)

Callers

nothing calls this directly

Calls 6

incrementFunction · 0.85
update_current_infoFunction · 0.85
build_requestFunction · 0.85
field_deleteMethod · 0.80
network_order_portMethod · 0.45
port_getMethod · 0.45

Tested by

no test coverage detected