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

Function does_encoding_match

src/iocore/cache/HttpTransactCache.cc:808–824  ·  view source on GitHub ↗

Match request Accept-Encoding with response Content-Encoding. First determine if the cached document has identity encoding. This can be the case if the document has no Content-Encoding header field or if the Content-Encoding field explicitly lists "identity". Then, if there is no Accept-Encoding header and the cached response uses identity encoding return a match. If there is no Accept-

Source from the content-addressed store, hash-verified

806
807*/
808static inline bool
809does_encoding_match(char *enc1, const char *enc2)
810{
811 if (is_asterisk(enc1) || ((strcasecmp(enc1, enc2)) == 0)) {
812 return true;
813 }
814
815 // rfc2616,sec3.5: applications SHOULD consider "x-gzip" and "x-compress" to be
816 // equivalent to "gzip" and "compress" respectively
817 if ((!strcasecmp(enc1, "gzip") && !strcasecmp(enc2, "x-gzip")) || (!strcasecmp(enc1, "x-gzip") && !strcasecmp(enc2, "gzip")) ||
818 (!strcasecmp(enc1, "compress") && !strcasecmp(enc2, "x-compress")) ||
819 (!strcasecmp(enc1, "x-compress") && !strcasecmp(enc2, "compress"))) {
820 return true;
821 }
822
823 return false;
824}
825
826bool
827HttpTransactCache::match_content_encoding(MIMEField *accept_field, const char *encoding_identifier)

Callers 2

Calls 2

is_asteriskFunction · 0.85
strcasecmpFunction · 0.85

Tested by

no test coverage detected