code wiki / (root) / nx_fetch_any.nx

nx_fetch_any.nx

buildroot/runtime/nx_fetch_any.nx

9487 B193 linesdepth 22pulls 151 transitivereach 91 importersview sourcekind tooltopic fetch
docsdependenciesstructsconstsfunctions

about

nx_fetch_any.nx -- EAT THE FETCH DEBT (operator 2026-07-14): the ONE intelligent fetch DISPATCHER the researcher / census / adversary / critic route through, so they "use and switch and be intelligent about" the ~200 fetch organs "as we gather information so we dont get errors and return nothing without informing the user." Rule-15 DRY: this does NOT add a new fetcher -- it COMPOSES the proven primitives into ONE classify->cascade->always-inform entry point. THE TWO SILENT FAILURES THIS KILLS (both proven live this session): * SILENT-EMPTY : a handshake/host failure returned 0 and the researcher banked NOTHING, with no record. * SILENT-BAD : nx_https_fetch_follow_best returns a Cloudflare 403 CHALLENGE PAGE with n>0, and the old rf_fetch_bank banked that challenge HTML as if it were real research (garbage in the corpus). THE CONTRACT (what "informing the user" means mechanically): nx_fetch_any ALWAYS writes a human-readable per-strategy attempts log into `att` (never left empty), and returns the byte count of a VERIFIED-REAL page (2xx, non-challenge, >= FA_MIN_BYTES) or 0. On 0 the caller MUST surface `att` (rf_fetch_bank banks it as <name>.fail) -- absence becomes DATA, never silence. THE CASCADE (each rung a real, existing, gated primitive): S1 nx_https_fetch_follow_best -- sovereign TLS-1.3 (2 hellos) -> TLS-1.2, redirects, cookie-jar+age-gate S2 nx_https_get_spoof -- real Firefox UA + browser Accept (+ cf_clearance cookie when supplied); beats UA-gating and Cloudflare walls the raw sovereign JA3 does not. (v2 rungs, wired next: nx_http_fetch plaintext:80 for HTTP-only hosts; nx_browser_fetch meta-refresh/JS.) 100% sovereign (own TLS, nx_cc->nxasm, no curl/wget/gcc). license_tier: ORIGINAL

dependencies 7 imports · 7 importers

nx_syscalls.nx nx_http_response_parse.nx nx_csprng.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_https_fetch_follow.nx nx_https_get_spoof.nx nx_fetch_any.nx nx_fetch_any_gate.nx nx_fetch_status_boundary_gate_t252 nx_fetch_status_live_gate_t252.nx nx_nist_ingest.nx nx_nvd_ingest.nx nx_research_engine.nx nx_research_engine_admission_t68.n

imports: nx_syscalls.nxnx_http_response_parse.nxnx_csprng.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.nxnx_https_get_spoof.nx

imported by: nx_fetch_any_gate.nxnx_fetch_status_boundary_gate_t252.nxnx_fetch_status_live_gate_t252.nxnx_nist_ingest.nxnx_nvd_ingest.nxnx_research_engine.nxnx_research_engine_admission_t68.nx

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

main fa_puts sys_write nx_trust_store_load_from_c 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 ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal sys_mmap ↻ nx_fetch_any

structs

none

consts

31const FA_MAGIC_4194304: i64 = 4194304
32const FA_MAGIC_8388608: i64 = 8388608
33const FA_MAGIC_8192: i64 = 8192
36const FA_MIN_BYTES: i64 = 256

functions

38func fa_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: mainmain calls 1: sys_write
39func fa_putn(v: i64) -> i64
called by 2: mainmain calls 2: sys_mmapsys_write
48func fa_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 3: fa_hashs_casemain
51func fa_find(hay: *u8, hl: i64, needle: *u8, nl: i64) -> i64
called by 2: fa_hasfa_body_off
63func fa_has(hay: *u8, hl: i64, lit: *u8) -> i64
called by 1: fa_challenge calls 2: fa_findfa_slen
69func fa_status(buf:*u8,n:i64)->i64
74func fa_challenge(buf: *u8, n: i64) -> i64
called by 3: fa_is_realnx_fetch_anymain calls 1: fa_has
86func fa_is_real(status: i64, buf: *u8, n: i64) -> i64
called by 2: nx_fetch_anymain calls 1: fa_challenge
95func fa_body_off(buf: *u8, n: i64) -> i64
called by 2: fa_to_bodymain calls 1: fa_find
103func fa_to_body(buf: *u8, n: i64) -> i64
called by 1: main calls 1: fa_body_off
112func fa_log(att: *u8, off: i64, cap: i64, s: *u8) -> i64
called by 1: nx_fetch_any
118func fa_logn(att: *u8, off: i64, cap: i64, v: i64) -> i64
called by 1: nx_fetch_any calls 1: sys_mmap
133func nx_fetch_any(url: *u8, store: *TrustStore, out: *u8, out_cap: i64, max_hops: i64, out_status: *i64,
177func main(argc: i64, argv: *i64) -> i64