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

499}
500
501static bool cookiePathMatches(const SC::HttpClientSessionCookie& cookie, SC::StringSpan path)
502{
503 if (cookie.path.isEmpty() or cookie.path == SC::StringSpan("/"))
504 {
505 return true;
506 }
507 if (not asciiStartsWith(path, cookie.path))
508 {
509 return false;
510 }
511 if (path.sizeInBytes() == cookie.path.sizeInBytes() or
512 cookie.path.toCharSpan()[cookie.path.sizeInBytes() - 1] == '/')
513 {
514 return true;
515 }
516 return path.toCharSpan()[cookie.path.sizeInBytes()] == '/';
517}
518
519static bool sessionIsIdempotentMethod(SC::HttpClientRequest::Method method)
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