code wiki / (root) / http_date.nx

http_date.nx

buildroot/runtime/http_date.nx

6387 B188 linesdepth 4pulls 4 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

syscalls.nx civil_date.nx http_date.nx rss.nx

imports: syscalls.nxcivil_date.nx

imported by: rss.nx

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

main unix_from_civil cd_fdiv http_date_format_unix 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

29const HD_ERR_FORMAT: i64 = -1
30const HD_ERR_SHORT: i64 = -2

functions

34func hd_weekday_bytes() -> *u8 {
called by 1: http_date_format
39func hd_month_bytes() -> *u8 {
44func hd_put3(out: *u8, off: i64, tbl: *u8, idx: i64) -> i64 {
called by 1: http_date_format
52func hd_put_2d(out: *u8, off: i64, v: i64) -> i64 {
called by 1: http_date_format
59func hd_put_4d(out: *u8, off: i64, v: i64) -> i64 {
called by 1: http_date_format
68func http_date_format(out: *u8, cap: i64, cd: *CivilDate) -> i64 {
93func http_date_format_unix(out: *u8, cap: i64, unix_sec: i64) -> i64 {
101func hd_parse_2d(buf: *u8, off: i64) -> i64 {
112func hd_parse_4d(buf: *u8, off: i64) -> i64 {
called by 1: http_date_parse calls 1: hd_parse_2d
121func hd_parse_month(buf: *u8, off: i64) -> i64 {
called by 1: http_date_parse calls 1: hd_month_bytes
138func http_date_parse(buf: *u8, n: i64, unix_sec_out: *i64) -> i64 {
168func main() -> i64 {