code wiki / _hdl_build / nx_site_handler.nx

nx_site_handler.nx

buildroot/runtime/_hdl_build/nx_site_handler.nx

4701 B80 linesdepth 4pulls 5 transitivereach 2 importersview sourcekind librarytopic site
docsdependenciesstructsconstsfunctions

about

nx_site_handler.nx -- the RECONCILED daemon's REQUEST HANDLER (bytes-in -> bytes-out, the part the TLS shell wraps). Parses the decrypted HTTP request (Host + path), runs the data-driven decision (rt_match route / sd_vhost docroot), and EITHER serves the vhost's docroot file (STATIC 200, or 404 if missing) OR signals the transport to PROXY (port+mode -- the streaming relay is the io layer's job). NO hardcoded routes/hosts. The cert was already chosen by the transport at handshake time (SNI -> cr_match), so the handler is route/static only. The gate drives this IN-PROCESS (craft request bytes -> assert response/decision), no TLS/socket. Composes nx_site_dispatch (rt_match + sd_vhost). license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_site_dispatch.nx nx_site_handler.nx nx_site_handler_gate.nx nx_sites_reconciled.nx

imports: nx_site_dispatch.nx

imported by: nx_site_handler_gate.nxnx_sites_reconciled.nx

structs

none

consts

9const SH_MAGIC_4096: i64 = 4096
10const SH_MAGIC_2048: i64 = 2048
12const SH_PROXY: i64 = 0 // dec[1]=port dec[2]=mode -> transport relays (out_n returned 0)
13const SH_STATIC: i64 = 1 // out holds a full 200 response (docroot file)
14const SH_NOTFOUND: i64 = 2 // out holds a full 404 response

functions

16func sh_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){d[o]=s[i];o=o+1;i=i+1} return o }
called by 1: sh_handle
17func sh_catb(d: *u8, o: i64, b: *u8, n: i64) -> i64 { var i: i64=0; while i<n {d[o]=b[i];o=o+1;i=i+1} return o }
called by 1: sh_handle
18func sh_catn(d: *u8, o: i64, v: i64) -> i64
called by 1: sh_handle
24func sh_path(req: *u8, n: i64, out: *u8, cap: i64) -> i64
called by 1: sh_handle
34func sh_host(req: *u8, n: i64, out: *u8, cap: i64) -> i64
called by 1: sh_handle
55func sh_handle(req: *u8, n: i64, rt: *u8, rtn: i64, vt: *u8, vtn: i64, out: *u8, dec: *i64) -> i64