code wiki / (root) / nx_cookie.nx

nx_cookie.nx

buildroot/runtime/nx_cookie.nx

6049 B191 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

cookie.nx -- parse HTTP Cookie header (RFC 6265 ยง4.2). Parses the Cookie request header value: "name1=value1; name2=value2; name3=value3" This is the client-sent form that every HTTP server sees on every authenticated request. Used for: session IDs, CSRF tokens, language prefs, A/B flags. Nishi-pages + sovereign HTTP handlers need this to validate session cookies. Differences from query.nx: - Separator is "; " (semicolon + space) per RFC, though we also accept bare ";" for robustness. - No percent-encoding on names; values may be quoted with surrounding double-quotes (we strip them on parse). - Empty values legal ("foo=; bar=baz") means cookie deletion. Not handled here: Set-Cookie (the server-sent response header) which has many more attributes (Path, Domain, Secure, HttpOnly, SameSite, Max-Age, Expires). That's a separate set_cookie.nx shipper for the writer side. Invariants: C1 Zero-alloc -- offsets into caller's buffer. C2 Leading/trailing whitespace on names + values trimmed. C3 Quoted values ("foo") have quotes stripped; embedded escaped characters NOT unescaped today (RFC doesn't specify quoted-string escape semantics for Cookie).

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_cookie.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap cookie_parse cookie_ltrim cookie_is_ws cookie_rtrim cookie_is_ws ↻ cookie_find

structs

40struct CookieEntry

consts

38const COOKIE_ERR_OVERFLOW: i64 = -1

functions

161func main() -> i64