| 484 | |
| 485 | template <class T> |
| 486 | void |
| 487 | CacheKey::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 | |
| 511 | template <class T> |
| 512 | void |
nothing calls this directly
no test coverage detected