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

Function eqIgnoreCaseWs

src/proxy/http/ForwardedConfig.cc:98–117  ·  view source on GitHub ↗

Compare a TextView to a nul-termimated string, converting the TextView to lower case and ignoring whitespace in it.

Source from the content-addressed store, hash-verified

96// Compare a TextView to a nul-termimated string, converting the TextView to lower case and ignoring whitespace in it.
97//
98bool
99eqIgnoreCaseWs(swoc::TextView sv, const char *target)
100{
101 const char *s = sv.data();
102
103 std::size_t skip = 0;
104 std::size_t i = 0;
105
106 while ((i + skip) < sv.size()) {
107 if (std::isspace(s[i + skip])) {
108 ++skip;
109 } else if (std::tolower(s[i + skip]) != target[i]) {
110 return false;
111 } else {
112 ++i;
113 }
114 }
115
116 return target[i] == '\0';
117}
118
119} // end anonymous namespace
120

Callers 1

optStrToBitsetFunction · 0.85

Calls 3

tolowerFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected