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

Method _parseCookieString

plugins/esi/lib/Variables.cc:368–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368void
369Variables::_parseCookieString(const char *str, int str_len)
370{
371 AttributeList cookies;
372 Utils::parseAttributes(str, str_len, cookies, ";,");
373 for (auto &iter : cookies) {
374 std::string cookie = iter.name;
375 size_t pos = cookie.find('=');
376
377 if (pos != std::string::npos) {
378 cookie = cookie.substr(0, pos);
379 }
380
381 bool found = false;
382 for (auto &_allowlistCookie : _allowlistCookies) {
383 if ((_allowlistCookie == "*") || (_allowlistCookie == cookie)) {
384 found = true;
385 }
386 }
387
388 if (found == true) {
389 _insert(_dict_data[HTTP_COOKIE], string(iter.name, iter.name_len), string(iter.value, iter.value_len));
390 DBG("[%s] Inserted cookie with name [%.*s] and value [%.*s]", __FUNCTION__, iter.name_len, iter.name, iter.value_len,
391 iter.value);
392 }
393 }
394}
395
396void
397Variables::_parseUserAgentString(const char * /* str ATS_UNUSED */, int /* str_len ATS_UNUSED */)

Callers

nothing calls this directly

Calls 4

parseAttributesFunction · 0.85
stringClass · 0.85
findMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected