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

Method HandleResponse

src/proxy/http/HttpTransact.cc:3447–3492  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// Name : HandleResponse Description: called from the state machine when a response is received Details : This is the entry into a coin-sorting machine. There are many different bins that the response can fall into. First, the response can be invalid if for example it is not a response, or not complete, or the conne

Source from the content-addressed store, hash-verified

3445//
3446///////////////////////////////////////////////////////////////////////////////
3447void
3448HttpTransact::HandleResponse(State *s)
3449{
3450 TxnDbg(dbg_ctl_http_trans, "Entering HttpTransact::HandleResponse");
3451 TxnDbg(dbg_ctl_http_seq, "Response received");
3452
3453 s->source = SOURCE_HTTP_ORIGIN_SERVER;
3454 s->response_received_time = ink_local_time();
3455 ink_assert(s->response_received_time >= s->request_sent_time);
3456 s->current.now = s->response_received_time;
3457
3458 TxnDbg(dbg_ctl_http_trans, "response_received_time: %" PRId64, (int64_t)s->response_received_time);
3459 dump_header(dbg_ctl_http_hdrs, &s->hdr_info.server_response, s->state_machine_id(), "Incoming O.S. Response");
3460
3461 Metrics::Counter::increment(http_rsb.incoming_responses);
3462
3463 ink_release_assert(s->current.request_to != ResolveInfo::UNDEFINED_LOOKUP);
3464 if (s->cache_info.action != CACHE_DO_WRITE) {
3465 ink_release_assert(s->cache_info.action != CACHE_DO_LOOKUP);
3466 ink_release_assert(s->cache_info.action != CACHE_DO_SERVE);
3467 ink_release_assert(s->cache_info.action != CACHE_PREPARE_TO_DELETE);
3468 ink_release_assert(s->cache_info.action != CACHE_PREPARE_TO_UPDATE);
3469 ink_release_assert(s->cache_info.action != CACHE_PREPARE_TO_WRITE);
3470 }
3471
3472 if (!HttpTransact::is_response_valid(s, &s->hdr_info.server_response)) {
3473 TxnDbg(dbg_ctl_http_seq, "Response not valid");
3474 } else {
3475 TxnDbg(dbg_ctl_http_seq, "Response valid");
3476 initialize_state_variables_from_response(s, &s->hdr_info.server_response);
3477 }
3478
3479 switch (s->current.request_to) {
3480 case ResolveInfo::PARENT_PROXY:
3481 handle_response_from_parent(s);
3482 break;
3483 case ResolveInfo::ORIGIN_SERVER:
3484 handle_response_from_server(s);
3485 break;
3486 default:
3487 ink_assert(!("s->current.request_to is not P.P. or O.S. - hmmm."));
3488 break;
3489 }
3490
3491 return;
3492}
3493
3494///////////////////////////////////////////////////////////////////////////////
3495// Name : HandleUpdateCachedObject

Callers

nothing calls this directly

Calls 4

ink_local_timeFunction · 0.85
dump_headerFunction · 0.85
incrementFunction · 0.85
state_machine_idMethod · 0.80

Tested by

no test coverage detected