| 1040 | { |
| 1041 | ParsedUrl parsed; |
| 1042 | if (not parseUrl(requestUrl, parsed)) |
| 1043 | return Result::Error(HttpClientResultCategory, HttpClientError::SessionRequestUrlInvalid); |
| 1044 | |
| 1045 | StringSpan firstAttribute; |
| 1046 | StringSpan remaining; |
| 1047 | if (not splitOnce(setCookie, ';', firstAttribute, remaining)) |
| 1048 | { |
| 1049 | firstAttribute = setCookie; |
| 1050 | remaining = StringSpan(setCookie.getEncoding()); |
| 1051 | } |
| 1052 | |
| 1053 | StringSpan name; |
| 1054 | StringSpan value; |
| 1055 | if (not splitOnce(firstAttribute, '=', name, value)) |
| 1056 | { |
| 1057 | return Result(true); |
| 1058 | } |
| 1059 | |
| 1060 | name = trimAsciiWhiteSpace(name); |
| 1061 | value = trimAsciiWhiteSpace(value); |
| 1062 | if (not isValidCookieName(name) or not isValidCookieValue(value)) |
| 1063 | { |
| 1064 | return Result(true); |
| 1065 | } |
| 1066 | |
| 1067 | StringSpan domain = parsed.host; |
| 1068 | StringSpan path = defaultCookiePath(parsed.path); |
| 1069 | uint8_t flags = 0; |
| 1070 | bool explicitDomain = false; |