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

Method handle_response_from_parent

src/proxy/http/HttpTransact.cc:3561–3699  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// Name : handle_response_from_parent Description: response came from a parent proxy Details : The configuration file can be used to specify more than one parent proxy. If a connection to one fails, another can be looked up. This function handles responses from parent proxies. If the response is bad the next parent

Source from the content-addressed store, hash-verified

3559//
3560///////////////////////////////////////////////////////////////////////////////
3561void
3562HttpTransact::handle_response_from_parent(State *s)
3563{
3564 auto next_lookup = ResolveInfo::UNDEFINED_LOOKUP;
3565 TxnDbg(dbg_ctl_http_trans, "(hrfp)");
3566 HTTP_RELEASE_ASSERT(s->current.server == &s->parent_info);
3567
3568 // if this parent was retried from a markdown, then
3569 // notify that the retry has completed.
3570 if (s->parent_result.retry) {
3571 markParentUp(s);
3572 }
3573
3574 simple_or_unavailable_server_retry(s);
3575
3576 s->parent_info.state = s->current.state;
3577 switch (s->current.state) {
3578 case CONNECTION_ALIVE:
3579 TxnDbg(dbg_ctl_http_trans, "[hrfp] connection alive");
3580 s->current.server->connect_result = 0;
3581 SET_VIA_STRING(VIA_DETAIL_PP_CONNECT, VIA_DETAIL_PP_SUCCESS);
3582 if (s->parent_result.retry) {
3583 markParentUp(s);
3584 }
3585 // the next hop strategy is configured not
3586 // to cache a response from a next hop peer.
3587 if (s->response_action.handled) {
3588 if (s->response_action.action.no_cache) {
3589 TxnDbg(dbg_ctl_http_trans, "plugin set response_action.no_cache, do not cache.");
3590 s->cache_info.action = CACHE_DO_NO_ACTION;
3591 }
3592 } else {
3593 if (s->parent_result.do_not_cache_response) {
3594 TxnDbg(dbg_ctl_http_trans, "response is from a next hop peer, do not cache.");
3595 s->cache_info.action = CACHE_DO_NO_ACTION;
3596 }
3597 }
3598 handle_forward_server_connection_open(s);
3599 break;
3600 case PARENT_RETRY:
3601 if (s->current.retry_type == PARENT_RETRY_SIMPLE) {
3602 s->current.simple_retry_attempts++;
3603 } else {
3604 markParentDown(s);
3605 s->current.unavailable_server_retry_attempts++;
3606 }
3607 next_lookup = find_server_and_update_current_info(s);
3608 s->current.retry_type = PARENT_RETRY_NONE;
3609 break;
3610 default:
3611 TxnDbg(dbg_ctl_http_trans, "[hrfp] connection not alive");
3612 SET_VIA_STRING(VIA_DETAIL_PP_CONNECT, VIA_DETAIL_PP_FAILURE);
3613
3614 ink_assert(s->hdr_info.server_request.valid());
3615
3616 s->current.server->connect_result = ENOTCONN;
3617 // only mark the parent down in hostdb if the configuration allows it and the parent,
3618 // is not congested, see proxy.config.http.parent_proxy.mark_down_hostdb in records.yaml.

Callers

nothing calls this directly

Calls 11

markParentUpFunction · 0.85
markParentDownFunction · 0.85
incrementFunction · 0.85
how_to_open_connectionFunction · 0.85
ats_ip_nptopFunction · 0.50
validMethod · 0.45
getMethod · 0.45
incrementMethod · 0.45

Tested by

no test coverage detected