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

Method url_looks_dynamic

src/proxy/http/HttpTransact.cc:6006–6060  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6004}
6005
6006bool
6007HttpTransact::url_looks_dynamic(URL *url)
6008{
6009 const char *p_start, *p, *t;
6010 static const char *asp = ".asp";
6011 const char *part;
6012 int part_length;
6013
6014 if (url->scheme_get_wksidx() != URL_WKSIDX_HTTP && url->scheme_get_wksidx() != URL_WKSIDX_HTTPS) {
6015 return false;
6016 }
6017 ////////////////////////////////////////////////////////////
6018 // (1) If URL contains query stuff in it, call it dynamic //
6019 ////////////////////////////////////////////////////////////
6020
6021 part = url->query_get(&part_length);
6022 if (part != nullptr) {
6023 return true;
6024 }
6025 ///////////////////////////////////////////////
6026 // (2) If path ends in "asp" call it dynamic //
6027 ///////////////////////////////////////////////
6028
6029 part = url->path_get(&part_length);
6030 if (part) {
6031 p = &part[part_length - 1];
6032 t = &asp[3];
6033
6034 while (p != part) {
6035 if (ParseRules::ink_tolower(*p) == ParseRules::ink_tolower(*t)) {
6036 p -= 1;
6037 t -= 1;
6038 if (t == asp) {
6039 return true;
6040 }
6041 } else {
6042 break;
6043 }
6044 }
6045 }
6046 /////////////////////////////////////////////////////////////////
6047 // (3) If the path of the url contains "cgi", call it dynamic. //
6048 /////////////////////////////////////////////////////////////////
6049
6050 if (part && part_length >= 3) {
6051 for (p_start = part; p_start <= &part[part_length - 3]; p_start++) {
6052 if (((p_start[0] == 'c') || (p_start[0] == 'C')) && ((p_start[1] == 'g') || (p_start[1] == 'G')) &&
6053 ((p_start[2] == 'i') || (p_start[2] == 'I'))) {
6054 return (true);
6055 }
6056 }
6057 }
6058
6059 return (false);
6060}
6061
6062///////////////////////////////////////////////////////////////////////////////
6063// Name : is_request_cache_lookupable()

Callers

nothing calls this directly

Calls 3

scheme_get_wksidxMethod · 0.80
query_getMethod · 0.45
path_getMethod · 0.45

Tested by

no test coverage detected