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

Method StartRemapRequest

src/proxy/http/HttpTransact.cc:983–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

981}
982
983void
984HttpTransact::StartRemapRequest(State *s)
985{
986 // Preserve effective url before remap, regardless of actual need for remap
987 s->unmapped_url.create(s->hdr_info.client_request.url_get()->m_heap);
988 s->unmapped_url.copy(s->hdr_info.client_request.url_get());
989
990 if (s->api_skip_all_remapping) {
991 TxnDbg(dbg_ctl_http_trans, "API request to skip remapping");
992
993 s->hdr_info.client_request.set_url_target_from_host_field();
994
995 // Since we're not doing remap, we still have to allow for these overridable
996 // configurations to modify follow-redirect behavior. Someone could for example
997 // have set them in a plugin other than conf_remap running in a prior hook.
998 s->state_machine->enable_redirection = (s->txn_conf->number_of_redirections > 0);
999
1000 if (s->is_upgrade_request && s->post_remap_upgrade_return_point) {
1001 TRANSACT_RETURN(SM_ACTION_POST_REMAP_SKIP, s->post_remap_upgrade_return_point);
1002 }
1003
1004 TRANSACT_RETURN(SM_ACTION_POST_REMAP_SKIP, HttpTransact::HandleRequest);
1005 }
1006
1007 TxnDbg(dbg_ctl_http_trans, "START HttpTransact::StartRemapRequest");
1008
1009 //////////////////////////////////////////////////////////////////
1010 // FIX: this logic seems awfully convoluted and hard to follow; //
1011 // seems like we could come up with a more elegant and //
1012 // comprehensible design that generalized things //
1013 //////////////////////////////////////////////////////////////////
1014
1015 /////////////////////////////////////////////////////////////////
1016 // run the remap url-rewriting engine: //
1017 // //
1018 // * the variable <url_remap_success> is set true if //
1019 // the url was rewritten //
1020 // //
1021 // * the variable <remap_redirect> is set to non-NULL if there //
1022 // is a URL provided that the proxy is supposed to redirect //
1023 // requesters of a particular URL to. //
1024 /////////////////////////////////////////////////////////////////
1025
1026 if (dbg_ctl_http_chdr_describe.on() || dbg_ctl_http_trans.on()) {
1027 TxnDbg(dbg_ctl_http_trans, "Before Remapping:");
1028 obj_describe(s->hdr_info.client_request.m_http, true);
1029 }
1030 dump_header(dbg_ctl_http_hdrs, &s->hdr_info.client_request, s->state_machine_id(), "Incoming Request");
1031
1032 if (s->http_config_param->referer_filter_enabled) {
1033 s->filter_mask = URL_REMAP_FILTER_REFERER;
1034 if (s->http_config_param->referer_format_redirect) {
1035 s->filter_mask |= URL_REMAP_FILTER_REDIRECT_FMT;
1036 }
1037 }
1038
1039 TxnDbg(dbg_ctl_http_trans, "END HttpTransact::StartRemapRequest");
1040

Callers

nothing calls this directly

Calls 8

obj_describeFunction · 0.85
dump_headerFunction · 0.85
url_getMethod · 0.80
state_machine_idMethod · 0.80
createMethod · 0.45
copyMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected