code wiki / (root) / nx_websocket_client_upgrade_test.nx

nx_websocket_client_upgrade_test.nx

buildroot/runtime/nx_websocket_client_upgrade_test.nx

6252 B144 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind gate/prooftopic websocket
docsdependenciesstructsconstsfunctions

about

nx_websocket_client_upgrade_test.nx -- KAT for CLIENT-side WebSocket HTTP/1.1 upgrade per RFC 6455 §1.3 + §4.1 + §4.2. Covers: T1: request-builder writes a syntactically correct GET upgrade T2: validator accepts a canonical 101 response keyed by RFC's §1.3 worked example (key = "dGhlIHNhbXBsZSBub25jZQ=="). T3: validator rejects bad status line (200 instead of 101) T4: validator rejects missing Upgrade header T5: validator rejects missing Connection header T6: validator rejects Sec-WebSocket-Accept that does not match SHA-1+Base64 of the client key + RFC GUID (i.e., a forged response or a real-but-mismatched-key bug). T7: include_port_in_host=1 adds ":port" to Host header Per Cardinal 13 (additive-only data: this test is the new gate for this module + it composes the SAME SHA-1+Base64 ws_accept primitive the server side uses to AVOID re-implementing the reference algorithm). expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_websocket_client_upgrade.nx nx_websocket_handshake.nx nx_websocket_client_upgrade_te

imports: nx_syscalls.nxnx_websocket_client_upgrade.nxnx_websocket_handshake.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_ws_client_build_request sys_mmap ↻ rand_bytes rand_open_urandom sys_openat_rd sys_read sys_close b64_encode b64_enc_char _wscu_itoa sys_mmap ↻ _t_find_sub _t_build_canonical_101 nx_ws_client_validate_resp _wscu_eq_cs _wscu_eol _wscu_find_header_end sys_mmap ↻ _wscu_find_header _wscu_eq_ci _wscu_tolower _wscu_skip_ws _wscu_eol ↻ _wscu_next_line _wscu_eq_ci ↻ ws_accept sys_mmap ↻ ws_guid sha1 sys_mmap ↻ sha1_process_block if_ge b64_encode ↻ _wscu_bytes_eq sys_write

structs

none

consts

none

functions

29func _t_find_sub(buf: *u8, n: i64, needle: *u8, nn: i64) -> i64
called by 1: main
46func _t_build_canonical_101(out: *u8) -> i64
called by 1: main
56func main() -> i64