nx_fetch_unit.nx
buildroot/runtime/nx_fetch_unit.nx
about
nx_fetch_unit.nx -- the SHARED staged-fetch unit (Rule #15: this logic lived
copy-pasted in _dlr_fetch_one + _ed_fetch_html; extracted 2026-06-10 in the
standards audit so the next consumer inherits fixes instead of forking them).
module: nishi-core.search.fetch_unit
depends: nx_https_get.nx stack
capability: CORE_COMPUTE
nx_fetch_staged(url, bodybuf, cap):
validated-HTTPS GET with 301/302/303/307/308 Location follow (https-only,
hop-capped FU_HOPS) and Transfer-Encoding chunked DECODE. Returns decoded
body length into bodybuf, or 0/negative on failure. Callers decide what
the body becomes (html->text, raw html, header probe...).
dependencies 6 imports · 6 importers
imports: nx_str.nxnx_syscalls.nxnx_csprng.nxnx_x509_trust_store.nxnx_pem_loader.nxnx_https_get.nx
imported by: _dlr_fetch_one.nx_ed_fetch_html.nxnx_apm_sweep.nxnx_clock_sitecheck.nxnx_sched_research_fetch.nxnx_url_get.nx
structs
| none |
consts
| 21 | const FU_MAGIC_2048: i64 = 2048 |
| 23 | const FU_CAP: i64 = 524288 |
| 24 | const FU_HOPS: i64 = 3 // 1 fetch + up to 2 redirect follows (anti-loop) |
functions
| 26 | func fu_body_off(resp: *u8, n: i64) -> i64 called by 1: nx_fetch_staged |
| 31 | func fu_lc(c: i64) -> i64 { if c >= 0x41 { if c <= 0x5A { return c + 0x20 } } return c } |
| 32 | func fu_find_ci(resp: *u8, lim: i64, needle: *u8) -> i64 |
| 47 | func fu_status(resp: *u8, n: i64) -> i64 called by 1: nx_fetch_staged |
| 59 | func fu_location(resp: *u8, hdr_lim: i64, cururl: *u8, loc: *u8, cap: i64) -> i64 |
| 89 | func fu_dechunk(resp: *u8, bo: i64, n: i64, out: *u8, cap: i64) -> i64 |
| 127 | func nx_fetch_staged(url: *u8, bodybuf: *u8, cap: i64) -> i64 |