code wiki / (root) / nx_http_client.nx

nx_http_client.nx

buildroot/runtime/nx_http_client.nx

37352 B759 linesdepth 5pulls 7 transitivereach 618 importersview sourcekind librarytopic http
docsdependenciesstructsconstsfunctions

about

nx_http_client.nx -- sovereign HTTP/1.1 GET client. Phase 0 of the Nishi browser per docs/NISHI_BROWSER_ROADMAP.md. Smallest possible NX-side HTTP client: TCP connect + send GET + receive response. No libc. No curl. No fetch shim. What it does today: - opens a TCP socket - connects to a caller-provided IPv4 address + port - sends "GET <path> HTTP/1.1\r\nHost: <host>\r\nConnection: close\r\n\r\n" - reads the response until the server closes - hands the caller the raw bytes (header + body) What it doesn't do yet: - DNS lookup (caller passes a packed IPv4 + port). L20b queued. - HTTP/1.1 keep-alive (we Connection: close to make the read-to-EOF pattern correct). - HTTP/2, HTTP/3, ALPN. Eventually. - TLS. Phase 8. - Redirects (302). Caller handles. genealogy_id: rfc_7230_http_1_1 + linux_socket_api + nishi_pages_v1_pages_nx lineage_id: nishi_browser_http_client_q10

dependencies 4 imports · 50 importers

nx_syscalls.nx nx_connect.nx nx_dec_emit.nx nx_codec_caps.nx nx_http_client.nx nx_acme_http.nx nx_aw_smoke.nx nx_bright_rewrite_lib.nx nx_browser_image_demo_test.nx nx_browser_page_demo_test.nx nx_cms_admin_gate.nx nx_cms_webdev_gate.nx nx_crawl_bfs.nx nx_crawl_main.nx nx_crawl_polite.nx

diagram shows first 10 each side; +0 more imports, +40 more importers in the complete lists below.

imports: nx_syscalls.nxnx_connect.nxnx_dec_emit.nxnx_codec_caps.nx

imported by: nx_acme_http.nxnx_aw_smoke.nxnx_bright_rewrite_lib.nxnx_browser_image_demo_test.nxnx_browser_page_demo_test.nxnx_cms_admin_gate.nxnx_cms_webdev_gate.nxnx_crawl_bfs.nxnx_crawl_main.nxnx_crawl_polite.nxnx_crawl_run.nxnx_embed_live_gate.nxnx_engine_dispatch.nxnx_f32_llm_serve.nxnx_forge_model.nxnx_http_client_gate.nxnx_http_client_post_test.nxnx_http_fetch.nxnx_http_loopback_gate.nxnx_http_post.nxnx_http_post_gate.nxnx_http_probe_lib.nxnx_http_tracker.nxnx_https_client.nxnx_https_get_complete.nxnx_https_get_spoof.nxnx_https_get_stream.nxnx_https_post_complete.nxnx_https_post_lib_gate.nxnx_live_crawl.nxnx_llm_batch_serve.nxnx_media_e2e_gate.nxnx_mesh_autoscale.nxnx_mesh_gen.nxnx_mesh_hostagent.nxnx_mesh_lb.nxnx_mesh_probe.nxnx_modelprobe.nxnx_office_serve.nxnx_search_crawl_server.nxnx_studio_e2e_gate.nxnx_torrent_daemon_gate.nxnx_torrent_gw.nxnx_torrent_stream_live_gate.nxnx_video_get.nxnx_vroom_loadtest.nxnx_wiki_projects.nxnx_writehub_grow.nxnx_writehub_seat.nxnx_writer_probe.nx

structs

none

consts

35const NX_MAGIC_1024: i64 = 1024
64const HC_CH_UPPER_A: i64 = 65
65const HC_CH_UPPER_Z: i64 = 90
66const HC_CH_CASE_DELTA: i64 = 32
67const HC_UA_BROWSER: i64 = 0 // default: Chrome UA matching our JA3. The browsing/HTTPS-GET/torrent paths.
68const HC_UA_BOT: i64 = 1 // honest crawler identity. The bulk crawler MUST select this.
148const HC_CH_DQUOTE: i64 = 34
214const NX_MAGIC_4096: i64 = 4096
217const NX_HTTP_C_VERDICT_UNKNOWN: i64 = 0
218const NX_HTTP_C_VERDICT_OK: i64 = 1
219const NX_HTTP_C_VERDICT_SOCKET_FAIL: i64 = 2
220const NX_HTTP_C_VERDICT_CONNECT_FAIL: i64 = 3
221const NX_HTTP_C_VERDICT_SEND_FAIL: i64 = 4
222const NX_HTTP_C_VERDICT_RECV_FAIL: i64 = 5
223const NX_HTTP_C_VERDICT_N: i64 = 6
238const NX_HTTP_C_CONNECT_MS: i64 = 6000
719const HC_HEADER_BAD_NAME: i64 = 0 - 40
720const HC_HEADER_BAD_VALUE: i64 = 0 - 41
721const HC_HEADER_OWNED_FIELD: i64 = 0 - 42

functions

70func hc_set_identity(mode: i64) -> i64 { hc_ua_mode_g = mode; return mode }
called by 1: main
71func hc_identity() -> i64 { return hc_ua_mode_g }
76func hc_put_ua(out: *u8, o0: i64) -> i64
108func hc_xhdr_has_field(xhdr: *u8, xhdr_len: i64, pat: *u8) -> i64
126func hc_xhdr_has_ua(xhdr: *u8, xhdr_len: i64) -> i64 { return hc_xhdr_has_field(xhdr, xhdr_len, "user-agent:" as *u8) }
131func hc_xhdr_has_ae(xhdr: *u8, xhdr_len: i64) -> i64 { return hc_xhdr_has_field(xhdr, xhdr_len, "accept-encoding:" as *u8) }
140func hc_put_ua_x(out: *u8, o: i64, xhdr: *u8, xhdr_len: i64) -> i64
150func hc_puts(out: *u8, o0: i64, s: *u8) -> i64
157func hc_putb(out: *u8, o: i64, b: i64) -> i64 { out[o] = b as u8; return o + 1 }
181func hc_put_hints(out: *u8, o0: i64) -> i64
202func hc_put_caps(out: *u8, o: i64) -> i64
255func nx_http_client_request_cap(path_len: i64, host_len: i64, cookie_len: i64, xhdr_len: i64) -> i64
259func nx_http_client_build_request(
313func nx_http_client_build_request_xhdr(
472func nx_http_client_build_request_post(
561func nx_http_client_build_request_post_xhdr(
637func nx_http_client_sockaddr_ipv4(
657func _drain(fd: i64, buf: *u8, cap: i64) -> i64
674func nx_http_client_get(
713func nx_http_c_verdict_is_valid(v: i64) -> i64
724func hc_header_token(c: i64) -> i64
731func hc_header_name_equal(p: *u8,n: i64,name: *u8) -> i64
743func hc_header_line_size(p: *u8,n: i64) -> i64