| 434 | } |
| 435 | |
| 436 | static bool cookieDomainMatches(const SC::HttpClientSessionCookie& cookie, SC::StringSpan host) |
| 437 | { |
| 438 | if ((cookie.flags & SC::HttpClientSessionCookie::DomainCookie) == 0) |
| 439 | { |
| 440 | return sessionAsciiEqualsIgnoreCase(cookie.domain, host); |
| 441 | } |
| 442 | |
| 443 | if (sessionAsciiEqualsIgnoreCase(cookie.domain, host)) |
| 444 | { |
| 445 | return true; |
| 446 | } |
| 447 | |
| 448 | if (host.sizeInBytes() <= cookie.domain.sizeInBytes() + 1) |
| 449 | { |
| 450 | return false; |
| 451 | } |
| 452 | const SC::Span<const char> hostBytes = host.toCharSpan(); |
| 453 | const size_t offset = host.sizeInBytes() - cookie.domain.sizeInBytes(); |
| 454 | if (hostBytes[offset - 1] != '.') |
| 455 | { |
| 456 | return false; |
| 457 | } |
| 458 | return sessionAsciiEqualsIgnoreCase( |
| 459 | {{hostBytes.data() + offset, cookie.domain.sizeInBytes()}, false, SC::StringEncoding::Ascii}, cookie.domain); |
| 460 | } |
| 461 | |
| 462 | static bool cookieDomainAttributeMatches(SC::StringSpan domain, SC::StringSpan host) |
| 463 | { |
no test coverage detected