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

Function response_cacheable_indicated_by_cc

src/proxy/http/HttpTransact.cc:6149–6166  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// Name : response_cacheable_indicated_by_cc() Description: check if a response is cacheable as indicated by Cache-Control Input : Response header, whether to ignored response's no-cache/no-store Output : -1, 0, or +1 Details : (1) return -1 if cache control indicates response not cacheable, ie, with no-sto

Source from the content-addressed store, hash-verified

6147//
6148///////////////////////////////////////////////////////////////////////////////
6149int
6150response_cacheable_indicated_by_cc(HTTPHdr *response, bool ignore_no_store_and_no_cache_directives)
6151{
6152 uint32_t cc_mask;
6153 // the following directives imply not cacheable
6154 cc_mask = MIME_COOKED_MASK_CC_PRIVATE | (ignore_no_store_and_no_cache_directives ? 0 : MIME_COOKED_MASK_CC_NO_STORE);
6155 if (response->get_cooked_cc_mask() & cc_mask) {
6156 return -1;
6157 }
6158 // the following directives imply cacheable
6159 cc_mask = (MIME_COOKED_MASK_CC_PUBLIC | MIME_COOKED_MASK_CC_MAX_AGE | MIME_COOKED_MASK_CC_S_MAXAGE |
6160 MIME_COOKED_MASK_CC_MUST_REVALIDATE | MIME_COOKED_MASK_CC_PROXY_REVALIDATE);
6161 if (response->get_cooked_cc_mask() & cc_mask) {
6162 return 1;
6163 }
6164 // otherwise, no indication
6165 return 0;
6166}
6167
6168///////////////////////////////////////////////////////////////////////////////
6169// Name : is_response_cacheable()

Callers 1

is_response_cacheableMethod · 0.85

Calls 1

get_cooked_cc_maskMethod · 0.80

Tested by

no test coverage detected