MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / cookiePathMatches

Function cookiePathMatches

Libraries/HttpClient/HttpClientSession.cpp:501–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499static bool isCookieIpHost(SC::StringSpan host)
500{
501 const SC::Span<const char> bytes = host.toCharSpan();
502 if (bytes.sizeInBytes() >= 2 and bytes[0] == '[' and bytes[bytes.sizeInBytes() - 1] == ']')
503 {
504 return true;
505 }
506
507 bool hasDot = false;
508 for (size_t idx = 0; idx < bytes.sizeInBytes(); ++idx)
509 {
510 if (bytes[idx] == '.')
511 {
512 hasDot = true;
513 }
514 else if (bytes[idx] < '0' or bytes[idx] > '9')
515 {
516 return false;
517 }
518 }
519 return hasDot;
520}

Callers 1

appendMatchingCookiesMethod · 0.85

Calls 4

StringSpanFunction · 0.85
asciiStartsWithFunction · 0.85
isEmptyMethod · 0.45
sizeInBytesMethod · 0.45

Tested by

no test coverage detected