code wiki / (root) / nx_http_probe.nx

nx_http_probe.nx

buildroot/runtime/nx_http_probe.nx

5531 B103 linesdepth 7pulls 10 transitivereach 0 importersview sourcekind probetopic http
docsdependenciesstructsconstsfunctions

about

nx_http_probe.nx -- CLI over nx_http_probe_lib. Sovereign bounded loopback HTTP probe and dead-man heartbeat stamper; retires the `curl | grep -q && date > log` cron one-liner that was the estate's only compensating control over a fail-open authentication path and whose own failure was unobservable. THIS FILE IS DELIBERATELY THIN. All logic lives in nx_http_probe_lib.nx so the gate can drive the SAME code the CLI drives -- a gate that re-implements its subject proves nothing about the subject. USAGE nx_http_probe <path> [expect-substring] [port] legacy positional form, byte-compatible with the pre-2026-08-20 organ (exit 0 ok / 1 usage / 2 connect-failed / 3 pattern-absent are unchanged). No heartbeat, no explicit budget. nx_http_probe watch <port> <path> <expect-substring> <budget-sec> <stamp-path> the supervised form: asserts a 2xx status AND the substring, and ONLY THEN writes `ts=<epoch>` to <stamp-path> for nx_cron_watch to read. Every failure is NAMED on stdout and on stderr and leaves the stamp untouched, so the watch goes STALE instead of reading healthy. Pass "" as <expect-substring> to assert liveness and status only. A path beginning with '/' can never be the literal verb `watch`, so the two grammars cannot collide. EXIT CODES (each is a diagnosis; hp_reason() names them in the output) 0 ok 1 usage 2 connect-failed 3 pattern-absent 4 status-not-2xx 5 stamp-write-failed 6 recv-timeout 7 send-failed 8 body-truncated-pattern-unproven 9 path-too-long 10 socket-failed 11 empty-response 12 not-http expect_exit: 0 license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 0 importers

nx_http_probe_lib.nx nx_http_probe.nx

imports: nx_http_probe_lib.nx

imported by: nobody (leaf or entry point)

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

main hpc_usage hp_streq hp_atoi hp_run hp_strlen hp_emit gw sys_write hp_reason gn sys_write ↻ 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 nxa_dump_sizes hp_werr sys_write ↻ hp_strlen ↻ hp_nerr sys_mmap ↻ sys_write ↻ sys_munmap sys_socket sys_mmap ↻ nx_connect_bounded nx_fcntl sys_connect sys_mmap ↻ sys_poll sys_munmap ↻

structs

none

consts

28const HPC_LEGACY_ARGC_PATH: i64 = 2
29const HPC_LEGACY_ARGC_EXPECT: i64 = 3
30const HPC_LEGACY_ARGC_PORT: i64 = 4
31const HPC_WATCH_ARGC: i64 = 7
32const HPC_PORT_DIGITS: i64 = 12
33const HPC_VERBOSE: i64 = 1

functions

35func hpc_usage() -> i64
called by 1: main
50func hpc_bad_port(s: *u8) -> i64
called by 1: main
60func main(argc: i64, argv: *i64) -> i64