Table of Contents
COOKIES: domain-aware HTTP cookie jar
Structures
| Name | |
|---|---|
| struct | N_COOKIE_JAR a thread-safe cookie jar |
| struct | N_COOKIE a single stored cookie |
Functions
| Name | |
|---|---|
| size_t | n_cookiejar_remove(N_COOKIE_JAR * jar, const char * name, const char * domain, const char * path) delete one stored cookie: name must match exactly, domain (case-insensitive) and path narrow it further, and either may be NULL to match any. |
| N_COOKIE_JAR * | n_cookiejar_new(void ) create an empty cookie jar; free with n_cookiejar_free. |
| void | n_cookiejar_free(N_COOKIE_JAR ** jar) free a cookie jar and all its cookies, then NULL the pointer |
| size_t | n_cookiejar_count(N_COOKIE_JAR * jar) number of cookies currently stored |
| void | n_cookiejar_clear(N_COOKIE_JAR * jar) drop every stored cookie |
| N_STR * | n_cookiejar_build_header(N_COOKIE_JAR * jar, const char * domain, const char * path, int is_secure) build a "name=value; name2=value2" Cookie header value for a request (domain/path/secure/expiry matched); free with free_nstr. |
| void | n_cookiejar_add_from_header(N_COOKIE_JAR * jar, const char * set_cookie_value, const char * request_domain) parse one Set-Cookie value (without the "Set-Cookie:" name) and store it; request_domain/path supply the defaults |
Functions Documentation
function n_cookiejar_remove
size_t n_cookiejar_remove(
N_COOKIE_JAR * jar,
const char * name,
const char * domain,
const char * path
)
delete one stored cookie: name must match exactly, domain (case-insensitive) and path narrow it further, and either may be NULL to match any.
Returns how many cookies were deleted — 0 when nothing matched, and at most 1 when name+domain are both given, since that pair is what n_cookiejar_add_from_header keeps unique. Enumerate jar->cookies (a LIST of N_COOKIE*) to pick the one to delete.
function n_cookiejar_new
N_COOKIE_JAR * n_cookiejar_new(
void
)
create an empty cookie jar; free with n_cookiejar_free.
Returns NULL on error.
function n_cookiejar_free
void n_cookiejar_free(
N_COOKIE_JAR ** jar
)
free a cookie jar and all its cookies, then NULL the pointer
function n_cookiejar_count
size_t n_cookiejar_count(
N_COOKIE_JAR * jar
)
number of cookies currently stored
function n_cookiejar_clear
void n_cookiejar_clear(
N_COOKIE_JAR * jar
)
drop every stored cookie
function n_cookiejar_build_header
N_STR * n_cookiejar_build_header(
N_COOKIE_JAR * jar,
const char * domain,
const char * path,
int is_secure
)
build a "name=value; name2=value2" Cookie header value for a request (domain/path/secure/expiry matched); free with free_nstr.
Returns NULL when no cookie matches.
function n_cookiejar_add_from_header
void n_cookiejar_add_from_header(
N_COOKIE_JAR * jar,
const char * set_cookie_value,
const char * request_domain
)
parse one Set-Cookie value (without the "Set-Cookie:" name) and store it; request_domain/path supply the defaults
Modules
- AABB3D
- ACCEPT_POOL
- ALLEGRO4
- ALLEGRO5
- ANIM_LIB
- ASTAR
- ATLAS_LIB
- AVRO
- CLOCK_SYNC
- COMMONS
- CONFIGFILE
- CYPHER_BASE64
- CYPHER_VIGENERE
- DEAD_RECKONING
- ENUMS
- EXCEPTIONS
- GAME_ENV
- GIT
- GUI
- HASH_TABLE
- ISOMETRIC_ENGINE
- LIST
- LOG
- LOGNODUP
- LZ4
- NETWORKING
- NETWORK_MSG
- N_COOKIES
- N_DIFF
- N_DIGEST
- N_DISK_CACHE
- N_DNS
- N_ECC
- N_ENTROPY
- N_FILES
- N_FLUIDS
- N_GUI_COLOR
- N_GUI_COLORWHEEL
- N_GUI_CURVE
- N_GUI_GRID
- N_GUI_POPUP
- N_HEX
- N_HTTP3
- N_HTTP_COOKIE
- N_HTTP_FORM
- N_HTTP_MIME
- N_HTTP_REQ
- N_HTTP_RESP
- N_HTTP_ROUTER
- N_HTTP_SERVER
- N_ICC
- N_JSON
- N_KAFKA
- N_LINALG
- N_MODULE
- N_OPENSSL_COMPAT
- N_PRETTY
- N_PTH
- N_QUERY
- N_RANDOM
- N_SHA256
- N_STR
- N_TIFF
- N_TIME
- N_USER
- N_X509
- N_ZIP
- PARTICLES
- PCRE
- PHYSICS
- SIGNALS
- STACK
- THREADS
- TRAJECTORY
- TREE
- ZLIB