![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Server-side cookies: read a Cookie header, build a Set-Cookie value. More...
Go to the source code of this file.
Data Structures | |
| struct | N_HTTP_SET_COOKIE |
| what a Set-Cookie should carry More... | |
Macros | |
| #define | N_HTTP_COOKIE_SESSION (-1LL) |
| Max-Age value meaning "session cookie": neither Max-Age nor Expires is sent. | |
Enumerations | |
| enum | N_HTTP_SAMESITE { N_HTTP_SAMESITE_UNSET = 0 , N_HTTP_SAMESITE_LAX = 1 , N_HTTP_SAMESITE_STRICT = 2 , N_HTTP_SAMESITE_NONE = 3 } |
| SameSite attribute of a Set-Cookie. More... | |
Functions | |
| size_t | n_http_cookie_count (const char *header, size_t len, const char *name) |
count the pairs named name in a Cookie header value | |
| const char * | n_http_cookie_get (const char *header, size_t len, const char *name, size_t *value_len) |
| find a cookie in a Cookie header value | |
| int | n_http_set_cookie_build (N_STR **out, const N_HTTP_SET_COOKIE *c) |
| append a Set-Cookie header value (without "Set-Cookie: ") | |
Server-side cookies: read a Cookie header, build a Set-Cookie value.
The server half of RFC 6265 (n_cookies.h is the client-side jar). Reading is zero-copy over the Cookie header value a request parser handed out; building refuses anything that would let a value break out of its attribute (CR, LF, ';', ',', spaces, quotes, controls) and enforces the cookie prefixes browsers enforce: a "__Host-" cookie must be Secure, have Path=/ and no Domain, a "__Secure-" one must be Secure, and SameSite=None must be Secure.
Definition in file n_http_cookie.h.