| 823 | bool SC::HttpClientSession::hasAuthorization(StringSpan origin) const |
| 824 | { |
| 825 | StringSpan authorizationHeader; |
| 826 | return findAuthorization(origin, authorizationHeader); |
| 827 | } |
| 828 | |
| 829 | bool SC::HttpClientSession::findCookie(StringSpan name, StringSpan domain, StringSpan path, |
| 830 | HttpClientSessionCookie& cookie) const |
| 831 | { |
| 832 | cookie = HttpClientSessionCookie(); |
| 833 | if (not initialized) |
| 834 | { |
| 835 | return false; |
| 836 | } |
| 837 | |
| 838 | for (size_t idx = 0; idx < sessionMemory.cookies.sizeInElements(); ++idx) |
| 839 | { |
| 840 | const HttpClientSessionCookie& candidate = sessionMemory.cookies[idx]; |
| 841 | if (candidate.isInUse() and sessionAsciiEqualsIgnoreCase(candidate.name, name) and |
| 842 | sessionAsciiEqualsIgnoreCase(candidate.domain, domain) and candidate.path == path) |
| 843 | { |
| 844 | cookie = candidate; |
| 845 | return true; |
| 846 | } |
| 847 | } |
| 848 | return false; |
| 849 | } |
| 850 | |
| 851 | bool SC::HttpClientSession::hasCookie(StringSpan name, StringSpan domain, StringSpan path) const |
| 852 | { |
| 853 | HttpClientSessionCookie cookie; |
| 854 | return findCookie(name, domain, path, cookie); |
| 855 | } |
| 856 | |
| 857 | SC::Result SC::HttpClientSession::makeBasicAuthorization(StringSpan username, StringSpan password, |
| 858 | Span<char> destination, StringSpan& authorizationHeader) |
| 859 | { |
| 860 | static const char Prefix[] = "Basic "; |
| 861 | static const size_t PrefixBytes = sizeof(Prefix) - 1; |
| 862 | static const char Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
| 863 | |
| 864 | const Span<const char> usernameBytes = username.toCharSpan(); |
| 865 | const Span<const char> passwordBytes = password.toCharSpan(); |
nothing calls this directly
no test coverage detected