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

Method processHeader

plugins/cachekey/cachekey.cc:486–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484
485template <class T>
486void
487CacheKey::processHeader(const String &name, const ConfigHeaders &config, T &dst,
488 void (*fun)(const ConfigHeaders &config, const String &name_s, const String &value_s, T &captures))
489{
490 TSMLoc field;
491
492 for (field = TSMimeHdrFieldFind(_buf, _hdrs, name.c_str(), name.size()); field != TS_NULL_MLOC;
493 field = ::nextDuplicate(_buf, _hdrs, field)) {
494 const char *value;
495 int vlen;
496 int count = TSMimeHdrFieldValuesCount(_buf, _hdrs, field);
497
498 for (int i = 0; i < count; ++i) {
499 value = TSMimeHdrFieldValueStringGet(_buf, _hdrs, field, i, &vlen);
500 if (value == nullptr || vlen == 0) {
501 CacheKeyDebug("missing value %d for header %s", i, name.c_str());
502 continue;
503 }
504
505 String value_s(value, vlen);
506 fun(config, name, value_s, dst);
507 }
508 }
509}
510
511template <class T>
512void

Callers

nothing calls this directly

Calls 6

TSMimeHdrFieldFindFunction · 0.85
nextDuplicateFunction · 0.70
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected