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

Method state_api_callout

src/proxy/http/HttpSM.cc:1355–1559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1353}
1354
1355int
1356HttpSM::state_api_callout(int event, void * /* data ATS_UNUSED */)
1357{
1358 // enum and variable for figuring out what the next action is after
1359 // after we've finished the api state
1360 enum AfterApiReturn_t {
1361 API_RETURN_UNKNOWN = 0,
1362 API_RETURN_CONTINUE,
1363 API_RETURN_DEFERED_CLOSE,
1364 API_RETURN_DEFERED_SERVER_ERROR,
1365 API_RETURN_ERROR_JUMP,
1366 API_RETURN_SHUTDOWN,
1367 API_RETURN_INVALIDATE_ERROR
1368 };
1369 AfterApiReturn_t api_next = API_RETURN_UNKNOWN;
1370
1371 if (event != EVENT_NONE) {
1372 STATE_ENTER(&HttpSM::state_api_callout, event);
1373 }
1374
1375 if (api_timer < 0) {
1376 // This happens when either the plugin lock was missed and the hook rescheduled or
1377 // the transaction got an event without the plugin calling TsHttpTxnReenable().
1378 // The call chain does not recurse here if @a api_timer < 0 which means this call
1379 // is the first from an event dispatch in this case.
1380 this->milestone_update_api_time();
1381 }
1382
1383 switch (event) {
1384 case HTTP_TUNNEL_EVENT_DONE:
1385 // This is a reschedule via the tunnel. Just fall through
1386 //
1387 case EVENT_INTERVAL:
1388 pending_action = nullptr;
1389 // FALLTHROUGH
1390 case EVENT_NONE:
1391 if (cur_hook_id == TS_HTTP_TXN_START_HOOK && t_state.client_info.port_attribute == HttpProxyPort::TRANSPORT_BLIND_TUNNEL) {
1392 /* Creating the request object early to set the host header and port for blind tunneling here for the
1393plugins required to work with sni_routing.
1394*/
1395 // Plugins triggered on txn_start_hook will get the host and port at that point
1396 // We've received a request on a port which we blind forward
1397 URL u;
1398
1399 t_state.hdr_info.client_request.create(HTTP_TYPE_REQUEST);
1400 t_state.hdr_info.client_request.method_set(HTTP_METHOD_CONNECT, HTTP_LEN_CONNECT);
1401 t_state.hdr_info.client_request.url_create(&u);
1402 u.scheme_set(URL_SCHEME_TUNNEL, URL_LEN_TUNNEL);
1403 t_state.hdr_info.client_request.url_set(&u);
1404
1405 NetVConnection *netvc = _ua.get_txn()->get_netvc();
1406 if (auto tts = netvc->get_service<TLSTunnelSupport>(); tts) {
1407 if (tts->has_tunnel_destination()) {
1408 auto tunnel_host = tts->get_tunnel_host();
1409 t_state.hdr_info.client_request.url_get()->host_set(tunnel_host.data(), tunnel_host.size());
1410 ushort tunnel_port = tts->get_tunnel_port();
1411 if (tunnel_port > 0) {
1412 t_state.hdr_info.client_request.url_get()->port_set(tunnel_port);

Callers

nothing calls this directly

Calls 15

ink_get_hrtimeFunction · 0.85
this_ethreadFunction · 0.85
method_setMethod · 0.80
url_createMethod · 0.80
scheme_setMethod · 0.80
get_txnMethod · 0.80
get_tunnel_hostMethod · 0.80
url_getMethod · 0.80
get_tunnel_portMethod · 0.80
get_local_portMethod · 0.80

Tested by

no test coverage detected