nx_http_fetch.nx
buildroot/runtime/nx_http_fetch.nx
about
nx_http_fetch.nx -- EAT THE DEBT: a plaintext HTTP (port 80, no TLS) fetch so HTTP-ONLY hosts are reachable.
images.cocodataset.org is an S3 static-website endpoint (HTTP-only) -> the TLS-only fetcher fails at handshake
(-3). This wires the SHIPPED pieces: nx_dns_a_resolve (host->IPv4, copied self-contained) + nx_http_client_get
(socket+GET+drain) + a minimal status/redirect parse. Follows http:// redirects (a redirect to https:// is
reported -- that host wants TLS, use the https fetcher). File-driven (data/mp_img_url.txt -> data/mp_img_dest.txt).
license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_http_client.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 9 | const K_MAGIC_4660: i64 = 4660 |
| 10 | const K_MAGIC_2048: i64 = 2048 |
| 11 | const K_MAGIC_4096: i64 = 4096 |
| 12 | const K_MAGIC_1024: i64 = 1024 |
| 13 | const K_MAGIC_16777216: i64 = 16777216 |
functions
| 15 | func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 16 | func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 } |
| 17 | func shx(v: i64) -> i64 { let b: *u8=sys_mmap(4); var i: i64=0; while i<2 { let n: i64=(v>>((1-i)*4))&0xF; if n<10{b[i]=(48+n) as u8} else {b[i]=(87+n) as u8} i=i+1 } sys_write(1,b,2); return 0 } |
| 18 | func rdcfg(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0{return 0-1} var n: i64=sys_read(fd,buf,cap-1); sys_close(fd); if n<0{return 0-1} var go: i64=1; while go==1{go=0; if n>0{ let c: i64=buf[n-1] as i64; if c==10{n=n-1;go=1} if c==13{n=n-1;go=1} if c==32{n=n-1;go=1} }} buf[n]=0 as u8; return n } |
| 21 | func da_u16(buf: *u8, o: i64) -> i64 { return ((buf[o] as i64) << 8) | (buf[o+1] as i64) } called by 1: da_parse |
| 22 | func da_qname(host: *u8, out: *u8, off: i64) -> i64 called by 1: da_build_query |
| 33 | func da_build_query(host: *u8, qid: i64, out: *u8) -> i64 |
| 38 | func da_skip_name(buf: *u8, off: i64, n: i64) -> i64 { var o: i64=off; while o<n { let b: i64=buf[o] as i64; if b==0{return o+1} if (b&0xc0)==0xc0{return o+2} o=o+1+b } return o } called by 1: da_parse |
| 39 | func da_parse(buf: *u8, n: i64, out_ip: *u8) -> i64 |
| 47 | func da_sockaddr(sa: *u8, port: i64, i0: i64, i1: i64, i2: i64, i3: i64) -> i64 called by 1: nx_dns_a_resolve |
| 51 | func nx_dns_a_resolve(host: *u8, out_ip: *u8) -> i64 called by 1: main calls 9: sys_socketsys_set_socket_timeoutsys_mmapda_sockaddrda_build_querysys_sendto+3 |
| 62 | func hf_find(buf: *u8, n: i64, from: i64, needle: *u8) -> i64 called by 1: main |
| 68 | func hf_parse_url(url: *u8, hbuf: *u8, pbuf: *u8) -> i64 called by 1: main |
| 84 | func main() -> i64 |