code wiki / _hdl_build / nx_polite_browser.nx

nx_polite_browser.nx

buildroot/runtime/_hdl_build/nx_polite_browser.nx

7522 B148 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic polite
docsdependenciesstructsconstsfunctions

about

nx_polite_browser.nx -- the first POLITE-BROWSER impersonation rung (toward Playwright-class access). Operator: "how does playwright work to access these sites ... be POLITE like playwright and a user would." Two first-class halves: 1. IMPERSONATE -- emit the REAL Chrome request header set (User-Agent + sec-ch-ua + Accept ordering) so a header-fingerprinting WAF serves us as a browser (the cheapest bot-detection rung; TLS-JA3 + a JS engine are the deeper follow-on rungs). 2. POLITE -- respect robots.txt (Disallow prefix under User-agent: *), honor Crawl-delay, rate-limit per host. A courteous USER, not an abusive scraper -- we DENY ourselves disallowed paths before fetching. Produces the headers + the politeness verdict; the transport (nx_h2_client_over_tls / nx_crawl_https) consumes them. BAKED GATE proves the robots allow/deny + crawl-delay parse. module: nishi-core.web.polite_browser depends: nishi-core.sys.syscalls capability: POLITE_BROWSER_IMPERSONATION_AND_ROBOTS license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_codec_caps.nx nx_polite_browser.nx

imports: nx_syscalls.nxnx_codec_caps.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap pb_cpy pb_robots_allowed pb_len pb_skip_sp pb_at pb_has_star pb_prefix pb_crawl_delay pb_skip_sp ↻ pb_at ↻ sys_openat_wr pb_w sys_write pb_wn sys_mmap ↻ sys_write ↻ sys_close pb_emit_headers pb_w ↻ sys_mmap ↻ nx_codec_caps_headers sys_mmap ↻ nx_codec_caps_accept_docum sys_mmap ↻ nx_codec_caps_accept_image cc_image_have nx_cc_put cc_image_name nx_cc_put ↻ nx_codec_caps_accept_encod cc_encoding_have nx_cc_put ↻ cc_encoding_name nx_cc_put ↻ sys_exit

structs

none

consts

18const PB_MAGIC_1024: i64 = 1024
20const PB_LOG: *u8 = "knowledge/status/polite_browser.log"

functions

22func pb_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 2: pb_emit_headersmain calls 1: sys_write
23func pb_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
24func pb_len(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: pb_robots_allowed
25func pb_cpy(dst: *u8, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[i]=s[i]; i=i+1} dst[i]=0 as u8; return i }
called by 1: main
28func pb_emit_headers(fd: i64) -> i64
52func pb_skip_sp(buf: *u8, p: i64, le: i64) -> i64 { var q: i64=p; while q<le { if buf[q]==(32 as u8){q=q+1} else { return q } } return le }
54func pb_at(buf: *u8, le: i64, i: i64, pat: *u8, pl: i64) -> i64
59func pb_has_star(buf: *u8, s: i64, le: i64) -> i64 { var p: i64=s; while p<le { if buf[p]==(42 as u8){return 1} p=p+1 } return 1 }
called by 1: pb_robots_allowed
61func pb_prefix(path: *u8, pl: i64, buf: *u8, ds: i64, de: i64) -> i64
called by 1: pb_robots_allowed
67func pb_robots_allowed(buf: *u8, n: i64, path: *u8) -> i64
95func pb_crawl_delay(buf: *u8, n: i64) -> i64
called by 1: main calls 2: pb_skip_sppb_at
118func main() -> i64