nx_http_date.nx
buildroot/runtime/nx_http_date.nx
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
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
structs
| none |
consts
| 34 | const HD_MAGIC_1994: i64 = 1994 |
| 36 | const HD_ERR_FORMAT: i64 = -1 |
| 37 | const HD_ERR_SHORT: i64 = -2 |
functions
| 41 | func hd_weekday_bytes() -> *u8 called by 1: http_date_format |
| 46 | func hd_month_bytes() -> *u8 |
| 51 | func hd_put3(out: *u8, off: i64, tbl: *u8, idx: i64) -> i64 called by 1: http_date_format |
| 59 | func hd_put_2d(out: *u8, off: i64, v: i64) -> i64 called by 1: http_date_format |
| 66 | func hd_put_4d(out: *u8, off: i64, v: i64) -> i64 called by 1: http_date_format |
| 75 | func http_date_format(out: *u8, cap: i64, cd: *CivilDate) -> i64 |
| 100 | func http_date_format_unix(out: *u8, cap: i64, unix_sec: i64) -> i64 |
| 108 | func hd_parse_2d(buf: *u8, off: i64) -> i64 |
| 119 | func hd_parse_4d(buf: *u8, off: i64) -> i64 |
| 128 | func hd_parse_month(buf: *u8, off: i64) -> i64 |
| 145 | func http_date_parse(buf: *u8, n: i64, unix_sec_out: *i64) -> i64 |
| 175 | func main() -> i64 |