code wiki / (root) / nx_range_header.nx

nx_range_header.nx

buildroot/runtime/nx_range_header.nx

6243 B152 linesdepth 2pulls 2 transitivereach 9 importersview sourcekind tooltopic range
docsdependenciesstructsconstsfunctions

about

Native byte-range parsing, RFC 9110 sections 14.1.1 and 14.1.2. Negative outcomes retain caller output. Serving policy owns HTTP status selection.

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_range_header.nx nx_host_router.nx nx_range_header_gate.nx

imports: nx_syscalls.nx

imported by: nx_host_router.nxnx_range_header_gate.nx

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

main sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ range_parse sys_mmap ↻ rh_parse_pass rh_ows rh_bounded rh_nonzero rh_is_digit rh_decimal_cmp sys_munmap

structs

10struct RangeSpec { start: i64, end: i64, }

consts

4const RH_ERR_FORMAT: i64 = -1
5const RH_ERR_UNIT: i64 = -2
6const RH_ERR_OVERFLOW: i64 = -3 // caller's range-array capacity
7const RH_ERR_UNSATISFIABLE: i64 = -4
8const RH_EMPTY_REPRESENTATION: i64 = -5
9const RH_ERR_NUMBER: i64 = -6 // legacy integer helper cannot represent the numeral

functions

11func rh_is_digit(b: i64) -> i64 { return ((b>=48)&&(b<=57)) as i64 }
called by 1: rh_parse_pass
12func rh_ows(b: i64) -> i64 { return ((b==32)||(b==9)) as i64 }
15func rh_parse_uint(buf: *u8, off: *i64, end: i64) -> i64
called by 1: main
30func rh_bounded(buf: *u8,off: *i64,n: i64,limit: i64) -> i64
called by 1: rh_parse_pass
43func rh_decimal_cmp(buf: *u8,a: i64,ae: i64,b: i64,be: i64) -> i64
called by 1: rh_parse_pass
51func rh_nonzero(buf: *u8,a: i64,b: i64) -> i64
called by 1: rh_parse_pass
55func rh_parse_pass(buf: *u8,n: i64,total: i64,ranges: *RangeSpec,cap: i64,pos: *i64) -> i64
107func range_parse(buf: *u8,n: i64,total_size: i64,ranges: *RangeSpec,cap: i64) -> i64
118func main() -> i64