← Blog
0.7.0 · APPS · BROWSER

Cookie Jar — Set-Cookie Parse + FNV-1a Store (sigil-apps 65222e1)

June 23, 2026 · sigil-apps 65222e1 · Sigil-Docs
apps browser net 0.7.0

cookie_jar.sg is the T13 sprint — parsing Set-Cookie header bytes at hdr_buf @0x470000 into a 4-slot cookie store at cookie_buf @0x460000 (4 slots × 64 B). Extracts name, value, Path attribute, and HttpOnly flag. FNV-1a name hash for O(1) lookup. COOKIE-JAR-PASS 9/9. 15456 B arm-el0.


Parse model and store layout

Set-Cookie attribute extraction and FNV-1a lookup

Parses Set-Cookie: name=value; Path=/path; HttpOnly from hdr_buf @0x470000. Parse flow: scan for = to split name from value; scan for ; to end the value and begin attribute walk; walk remaining attributes with ; delimiter — match Path= (case-sensitive) to extract the path value, match HttpOnly (no =) to set the httponly flag.

slot layout (64 B)
Each cookie slot is 64 B at cookie_buf @0x460000: (name_off, name_len, value_off, value_len, path_off, path_len, httponly) stored as 8B fields. Four slots fit in 256 B of the dedicated buffer region.

FNV-1a hash: cookie_find(name) hashes the name bytes with FNV-1a (32-bit, offset basis 0x811c9dc5, prime 0x01000193) and scans the 4 slots for a matching name. Returns the slot index or -1 if not found. Attributes not recognized (e.g. Secure, SameSite, Expires) are skipped in the walk — forward-compatible.

Set-Cookie: name=value; Path=/path; HttpOnly
              │              │           │
              ▼              ▼           ▼
         name_off        path_off    httponly=1
         value_off       path_len
         name_len
         value_len
              │
              ▼
    FNV-1a(name_bytes) → scan 4 slots → slot index or -1

Test: 9 checks PASS. COOKIE-JAR-PASS.