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

Function checkHeaderValue

plugins/esi/esi.cc:1166–1201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1164}
1165
1166static bool
1167checkHeaderValue(TSMBuffer bufp, TSMLoc hdr_loc, const char *name, int name_len, const char *exp_value, int exp_value_len,
1168 bool prefix)
1169{
1170 TSMLoc field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, name, name_len);
1171 if (!field_loc) {
1172 return false;
1173 }
1174 bool retval = false;
1175 if (exp_value && exp_value_len) {
1176 const char *value;
1177 int value_len;
1178 int n_values = TSMimeHdrFieldValuesCount(bufp, hdr_loc, field_loc);
1179 for (int i = 0; i < n_values; ++i) {
1180 value = TSMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, i, &value_len);
1181 if (nullptr != value && value_len) {
1182 if (prefix) {
1183 if ((value_len >= exp_value_len) && (strncasecmp(value, exp_value, exp_value_len) == 0)) {
1184 retval = true;
1185 }
1186 } else if (Utils::areEqual(value, value_len, exp_value, exp_value_len)) {
1187 retval = true;
1188 }
1189 } else {
1190 Dbg(dbg_ctl_local, "[%s] Error while getting value # %d of header [%.*s]", __FUNCTION__, i, name_len, name);
1191 }
1192 if (retval) {
1193 break;
1194 }
1195 }
1196 } else { // only presence required
1197 retval = true;
1198 }
1199 TSHandleMLocRelease(bufp, hdr_loc, field_loc);
1200 return retval;
1201}
1202
1203static void
1204maskOsCacheHeaders(TSHttpTxn txnp)

Callers 4

getServerStateMethod · 0.85
modifyResponseHeaderFunction · 0.85
isTxnTransformableFunction · 0.85
isInterceptRequestFunction · 0.85

Calls 5

TSMimeHdrFieldFindFunction · 0.85
areEqualFunction · 0.85
TSHandleMLocReleaseFunction · 0.85

Tested by

no test coverage detected