code wiki / bin / nx_http_redirect_daemon.nx

nx_http_redirect_daemon.nx

buildroot/runtime/bin/nx_http_redirect_daemon.nx

5888 B148 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind servicetopic http
docsdependenciesstructsconstsfunctions

about

nx_http_redirect_daemon.nx -- sovereign plain-HTTP listener that 301-redirects everything to HTTPS. Pure Nishi, no TLS, no libc. Operator 2026-05-28: "redirect the http to it" -- port 80 must send browsers to https:// instead of landing on the Synology DSM (:5000). Listens on 0.0.0.0:8080 (GL forwards public :80 here). For each request it reads the start line + Host header and replies: HTTP/1.0 301 Moved Permanently Location: https://<host><path> preserving the requested path so deep links survive the upgrade. Public-exposure hardened (SO_RCVTIMEO/SNDTIMEO) + constant memory (all buffers hoisted out of the accept loop) -- same discipline as nx_sites_daemon (PREVENT: no sys_mmap in the loop).

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_http_server.nx nx_http_redirect_daemon.nx

imports: nx_syscalls.nxnx_http_server.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 nx_http_server_addr_any nx_http_server_make_sockad nx_http_server_listen sys_ignore_sigpipe sys_mmap ↻ sys_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close sys_listen sys_write nx_http_server_accept_one sys_accept sys_set_socket_timeout sys_mmap ↻ sys_setsockopt ↻ sys_munmap sys_read sys_openat_rd sys_close ↻ rd_find

structs

none

consts

20const NX_RD_PORT: i64 = 8080
21const NX_RD_BUDGET: i64 = 100000000

functions

23func rd_find(hay: *u8, hlen: i64, needle: *u8, nlen: i64) -> i64
called by 1: main
40func main() -> i64