Module http::cookie
HTTP cookies (RFC 6265).
Reading: a request's "Cookie: a=1; b=2" header parsed into name/value pairs (CookieList, or HttpRequest::cookie() in std/http/http.h for one value). Writing: SetCookie builds a "Set-Cookie" header value with its attributes; http_set_cookie adds one to a response. SetCookie::parse reads one back (what a client stores).
Values are taken and written verbatim (RFC 6265 allows no escaping): a value with spaces, ';', ',' or '"' should be encoded by the caller — url_encode/form_encode (std/encoding/url.h) are the usual choice.
Structs
| CookiePair | |
| CookieList | The cookies of one Cookie header, in order. |
| SetCookie |
Functions
| http_set_cookie | Appends "Set-Cookie: <c.to_string()>" to the response's headers (one per call; several cookies mean several calls). |
Macros
| COOKIE_SAMESITE_UNSET | |
| COOKIE_SAMESITE_LAX | |
| COOKIE_SAMESITE_STRICT | |
| COOKIE_SAMESITE_NONE |