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

Function does_charset_match

src/iocore/cache/HttpTransactCache.cc:688–692  ·  view source on GitHub ↗

Match request Accept-Charset with response Content-Type. Extract the response charset from the Content-Type field - the charset is after the semicolon. Loop through the charsets in the request's Accept-Charset field. If the Accept-Charset value is a wildcard, do not attempt to match. Otherwise match and note the highest q value. If after the loop the q value is -1, indicating no match,

Source from the content-addressed store, hash-verified

686
687*/
688static inline bool
689does_charset_match(char *charset1, char *charset2)
690{
691 return (is_asterisk(charset1) || is_empty(charset1) || (strcasecmp(charset1, charset2) == 0));
692}
693
694float
695HttpTransactCache::calculate_quality_of_accept_charset_match(MIMEField *accept_field, MIMEField *content_field,

Calls 3

is_asteriskFunction · 0.85
strcasecmpFunction · 0.85
is_emptyFunction · 0.70

Tested by

no test coverage detected