code wiki / (root) / nx_http_date.nx

nx_http_date.nx

buildroot/runtime/nx_http_date.nx

6497 B195 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind tooltopic http
docsdependenciesstructsconstsfunctions

about

http_date.nx -- format + parse RFC 7231 IMF-fixdate. HTTP's native date format: Sun, 06 Nov 1994 08:49:37 GMT ^^^ ^^ ^^^ ^^^^ ^^ ^^ ^^ ^^^ wkd dd mon yyyy hh mm ss tz Used in: Date, Last-Modified, Expires, If-Modified-Since, If-Unmodified-Since headers. RFC 7231 ยง7.1.1 strongly prefers this form over the older rfc850 / asctime variants; we only produce fixdate and accept fixdate on parse. Always emitted with UTC / "GMT" suffix. Composes civil_date.nx. Built from the same primitives as iso8601.nx but with English weekday + month names. Invariants: HD1 Output is exactly 29 bytes. HD2 Parser rejects non-fixdate forms (no rfc850 "Sun-day, 06-Nov-94" or asctime "Sun Nov 6 ..." -- per RFC 7231 those are deprecated; we log instead of silently accept). HD3 Round-trip exact for the fixdate form we emit.

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_civil_date.nx nx_http_date.nx nx_rss.nx

imports: nx_syscalls.nxnx_civil_date.nx

imported by: nx_rss.nx

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

main unix_from_civil cd_fdiv sys_mmap http_date_format_unix sys_mmap ↻ civil_from_unix cd_fdiv ↻ cd_fmod cd_fdiv ↻ http_date_format hd_put3 hd_weekday_bytes hd_put_2d hd_month_bytes hd_put_4d http_date_parse hd_parse_2d hd_parse_month hd_month_bytes ↻ hd_parse_4d hd_parse_2d ↻ unix_from_civil ↻

structs

none

consts

34const HD_MAGIC_1994: i64 = 1994
36const HD_ERR_FORMAT: i64 = -1
37const HD_ERR_SHORT: i64 = -2

functions

41func hd_weekday_bytes() -> *u8
called by 1: http_date_format
46func hd_month_bytes() -> *u8
51func hd_put3(out: *u8, off: i64, tbl: *u8, idx: i64) -> i64
called by 1: http_date_format
59func hd_put_2d(out: *u8, off: i64, v: i64) -> i64
called by 1: http_date_format
66func hd_put_4d(out: *u8, off: i64, v: i64) -> i64
called by 1: http_date_format
75func http_date_format(out: *u8, cap: i64, cd: *CivilDate) -> i64
100func http_date_format_unix(out: *u8, cap: i64, unix_sec: i64) -> i64
108func hd_parse_2d(buf: *u8, off: i64) -> i64
119func hd_parse_4d(buf: *u8, off: i64) -> i64
called by 1: http_date_parse calls 1: hd_parse_2d
128func hd_parse_month(buf: *u8, off: i64) -> i64
called by 1: http_date_parse calls 1: hd_month_bytes
145func http_date_parse(buf: *u8, n: i64, unix_sec_out: *i64) -> i64
175func main() -> i64