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

Function defaultCookiePath

Libraries/HttpClient/HttpClientSession.cpp:483–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483static SC::StringSpan defaultCookiePath(SC::StringSpan requestPath)
484{
485 const SC::Span<const char> bytes = requestPath.toCharSpan();
486 if (bytes.sizeInBytes() == 0 or bytes[0] != '/')
487 {
488 return SC::StringSpan("/");
489 }
490
491 for (size_t idx = bytes.sizeInBytes(); idx > 0; --idx)
492 {
493 if (bytes[idx - 1] == '/')
494 {
495 return idx == 1 ? SC::StringSpan("/") : sliceString(requestPath, 0, idx - 1);
496 }
497 }
498 return SC::StringSpan("/");
499}
500
501static bool cookiePathMatches(const SC::HttpClientSessionCookie& cookie, SC::StringSpan path)
502{

Callers 1

captureSetCookieMethod · 0.85

Calls 3

StringSpanFunction · 0.85
sliceStringFunction · 0.85
sizeInBytesMethod · 0.45

Tested by

no test coverage detected