code wiki / (root) / nx_browser_fetch.nx

nx_browser_fetch.nx

buildroot/runtime/nx_browser_fetch.nx

7096 B122 linesdepth 22pulls 130 transitivereach 9 importersview sourcekind librarytopic browser
docsdependenciesstructsconstsfunctions

about

nx_browser_fetch.nx -- the practical render-front fetch: browser headers (nx_https_get_spoof: real Firefox UA + Accept) AND redirect-following, which neither existing fetch did together. This is what actually retrieves media from real hosts -- they UA-gate non-browser clients AND 301 to a CDN. bf_fetch_follow loops the spoof GET across 3xx Location redirects (bounded), returning the final raw response. For HARD hosts (Cloudflare-grade TLS-fingerprint + JS challenges) the full Nishi-browser render is still needed -- but this covers the common case (abandonware / niche sites, which are rarely behind advanced bot-walls). license_tier: ORIGINAL

dependencies 3 imports · 8 importers

nx_syscalls.nx nx_x509_trust_store.nx nx_https_get_spoof.nx nx_browser_fetch.nx nx_archive_daemon.nx nx_bench_warc.nx nx_bf_live.nx nx_crawl_preserve.nx nx_ia_resolve.nx nx_meta_refresh_gate.nx nx_preserve_live.nx zz_bf.nx

imports: nx_syscalls.nxnx_x509_trust_store.nxnx_https_get_spoof.nx

imported by: nx_archive_daemon.nxnx_bench_warc.nxnx_bf_live.nxnx_crawl_preserve.nxnx_ia_resolve.nxnx_meta_refresh_gate.nxnx_preserve_live.nxzz_bf.nx

structs

none

consts

10const K_MAGIC_8192: i64 = 8192

functions

12func bf_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
13func bf_find(hay: *u8, hl: i64, needle: *u8, nl: i64, from: i64) -> i64
20func bf_status(resp: *u8, n: i64) -> i64 { if n < 12 { return 0 } return (((resp[9]&0xff)-48)*100) + (((resp[10]&0xff)-48)*10) + ((resp[11]&0xff)-48) }
22func bf_location(resp: *u8, n: i64, out: *u8, cap: i64) -> i64
called by 1: bf_fetch_follow calls 1: bf_find
34func bf_fetch_follow(url: *u8, store: *TrustStore, cr: *u8, pk: *u8, now: i64, out: *u8, cap: i64, maxredir: i64) -> i64
62func bf_body_off(resp: *u8, n: i64) -> i64 { let p: i64 = bf_find(resp, n, "\r\n\r\n" as *u8, 4, 0); if p < 0 { return 0 } return p + 4 }
called by 3: ad_homemainbf_fetch_meta calls 1: bf_find
64func bf_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: bf_ci_find
66func bf_ci_find(hay: *u8, hl: i64, needle: *u8, nl: i64, from: i64) -> i64
called by 1: bf_meta_refresh calls 1: bf_lc
75func bf_meta_refresh(html: *u8, hlen: i64, out: *u8, cap: i64) -> i64
called by 2: bf_fetch_metamref calls 2: bf_ci_findbf_find
102func bf_fetch_meta(url: *u8, store: *TrustStore, cr: *u8, pk: *u8, now: i64, out: *u8, cap: i64, maxhops: i64) -> i64