code wiki / (root) / nx_cache_control.nx

nx_cache_control.nx

buildroot/runtime/nx_cache_control.nx

8701 B270 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

cache_control.nx -- parse HTTP Cache-Control header. RFC 7234 §5.2. Controls caching behaviour at every level (browser, proxy, CDN, reverse-proxy). Getting it right is the difference between a fast site and a stampeded origin. Format: comma-separated directives, some with arguments. Cache-Control: max-age=3600, public Cache-Control: no-store Cache-Control: private, max-age=0, must-revalidate Cache-Control: public, max-age=31536000, immutable Cache-Control: no-cache, s-maxage=600 We parse into a typed CacheControl struct with flag bits for the named directives + integer values for max-age / s-maxage / max-stale / min-fresh / stale-while-revalidate. Invariants: CC1 Empty input yields default CacheControl (all flags 0, ages = -1 meaning \"not specified\"). CC2 Unknown directives silently ignored per RFC 7234 §5.2 tolerance rule. CC3 Directive names are case-insensitive (we lowercase on match). Argument values are case-sensitive integers.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_cache_control.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 cache_control_parse cache_control_init cc_eq_ci cc_lower cc_parse_int

structs

36struct CacheControl

consts

33const K_MAGIC_3600: i64 = 3600
34const K_MAGIC_31536000: i64 = 31536000

functions

58func cache_control_init(cc: *CacheControl) -> i64
called by 1: cache_control_parse
78func cc_lower(b: i64) -> i64
called by 1: cc_eq_ci
86func cc_eq_ci(a: *u8, a_off: i64, a_len: i64,
called by 1: cache_control_parse calls 1: cc_lower
98func cc_parse_int(buf: *u8, off: i64, end: i64) -> i64
called by 1: cache_control_parse
116func cache_control_parse(buf: *u8, n: i64, cc: *CacheControl) -> i64
240func main() -> i64