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

Method handle_forward_server_connection_open

src/proxy/http/HttpTransact.cc:3982–4073  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// Name : handle_forward_server_connection_open Description: connection to a forward server is open and good Details : "Forward server" includes the parent proxy or the origin server. This function first determines if the forward server uses HTTP 0.9, in which case it simply tunnels the response to the client. Else,

Source from the content-addressed store, hash-verified

3980//
3981///////////////////////////////////////////////////////////////////////////////
3982void
3983HttpTransact::handle_forward_server_connection_open(State *s)
3984{
3985 TxnDbg(dbg_ctl_http_trans, "(hfsco)");
3986 TxnDbg(dbg_ctl_http_seq, "Entering HttpTransact::handle_server_connection_open");
3987 ink_release_assert(s->current.state == CONNECTION_ALIVE);
3988
3989 HTTPVersion real_version = s->state_machine->get_server_version(s->hdr_info.server_response);
3990 if (real_version != s->dns_info.http_version) {
3991 // Need to update the hostdb
3992 s->updated_server_version = real_version;
3993 TxnDbg(dbg_ctl_http_trans, "Update hostdb history of server HTTP version 0x%x", s->updated_server_version.get_flat_version());
3994 }
3995
3996 s->state_machine->do_hostdb_update_if_necessary();
3997
3998 if (s->hdr_info.server_response.status_get() == HTTP_STATUS_CONTINUE ||
3999 s->hdr_info.server_response.status_get() == HTTP_STATUS_EARLY_HINTS) {
4000 handle_100_continue_response(s);
4001 return;
4002 }
4003
4004 if (s->www_auth_content == CACHE_AUTH_FRESH) {
4005 // no update is needed - either to serve from cache if authorized,
4006 // or tunnnel the server response
4007 if (s->hdr_info.server_response.status_get() == HTTP_STATUS_OK) {
4008 // borrow a state variable used by the API function
4009 // this enable us to serve from cache without doing any updating
4010 s->api_server_response_ignore = true;
4011 }
4012 // s->cache_info.action = CACHE_PREPARE_TO_SERVE;
4013 // xing in the tunneling case, need to check when the cache_read_vc is closed, make sure the cache_read_vc is closed
4014 // right away
4015 }
4016
4017 CacheVConnection *cw_vc = s->state_machine->get_cache_sm().cache_write_vc;
4018
4019 if (s->redirect_info.redirect_in_process && s->state_machine->enable_redirection) {
4020 if (s->cache_info.action == CACHE_DO_NO_ACTION) {
4021 switch (s->hdr_info.server_response.status_get()) {
4022 case HTTP_STATUS_MULTIPLE_CHOICES: // 300
4023 case HTTP_STATUS_MOVED_PERMANENTLY: // 301
4024 case HTTP_STATUS_MOVED_TEMPORARILY: // 302
4025 case HTTP_STATUS_SEE_OTHER: // 303
4026 case HTTP_STATUS_USE_PROXY: // 305
4027 case HTTP_STATUS_TEMPORARY_REDIRECT: // 307
4028 case HTTP_STATUS_PERMANENT_REDIRECT: // 308
4029 break;
4030 default:
4031 TxnDbg(dbg_ctl_http_trans, "[hfsco] redirect in progress, non-3xx response, setting cache_do_write");
4032 if (cw_vc && s->txn_conf->cache_http) {
4033 s->cache_info.action = CACHE_DO_WRITE;
4034 }
4035 break;
4036 }
4037 }
4038 }
4039

Callers

nothing calls this directly

Calls 4

get_server_versionMethod · 0.80
get_flat_versionMethod · 0.80
status_getMethod · 0.45

Tested by

no test coverage detected