code wiki / (root) / nx_https_get_complete.nx

nx_https_get_complete.nx

buildroot/runtime/nx_https_get_complete.nx

25993 B516 linesdepth 11pulls 40 transitivereach 539 importersview sourcekind tooltopic https
docsdependenciesstructsconstsfunctions

about

nx_https_get_complete.nx -- step 4 of the nx_https_client wiring arc. THE LAST piece before nx_https_get(url, store) works end-to-end. Takes a connected TLS 1.3 session (state == CONNECTED, app traffic keys derived in step 3c.5) + a path + a host + an out buffer. Encrypts an HTTP/1.1 GET request as an application_data TLS record under client_app_traffic_key + sends + reads the server's encrypted response records in a loop + decrypts each under server_app_traffic_key + accumulates plaintext into out_buf until peer-close (close_notify alert OR TCP EOF). Returns total bytes accumulated into out_buf on success (POSITIVE). Negative -NX_HTTPS_GC_* verdict on failure. Composes 4 shipped substrate primitives: nx_http_client_build_request -- 4-line HTTP/1.1 GET nx_tls13_record_encrypt -- AEAD wrap nx_tls13_read_record_from_fd -- partial-read framer nx_tls13_record_decrypt -- AEAD unwrap HTTP/1.1 Connection: close semantics: The shipped nx_http_client_build_request emits "Connection: close" so the server closes after responding. We read until EOF (or close_notify) and return whatever was accumulated. Per-response chunking + Content-Length parsing is a later refinement (the calling Browser arc parses HTTP body from the returned bytes). Public API: nx_https_get_complete( session, fd, path, path_len, host, host_len, out_buf, out_cap ) -> POSITIVE bytes_received | NEGATIVE -NX_HTTPS_GC_* code nx_https_gc_verdict_is_valid(v) -> 0|1 Sealed verdict: NX_HTTPS_GC_OK positive rc = bytes received NX_HTTPS_GC_BAD_STATE session not at CONNECTED NX_HTTPS_GC_BUILD_FAIL request builder returned non-positive

dependencies 7 imports · 65 importers

nx_syscalls.nx nx_tls13.nx nx_tls13_record.nx nx_tls13_read_record_from_fd.nx nx_tls13_client_session.nx nx_http_client.nx nx_chacha20_poly1305.nx nx_https_get_complete.nx _dlr_probe.nx nx_acme_directory_live.nx nx_acme_directory_live_real_ca_tes nx_acme_http.nx nx_app_monitor.nx nx_aw_verify_gate.nx nx_browser_own_site_live_test.nx nx_cad_verify_gate.nx nx_chrome_fetch_probe.nx nx_connect_live_verify.nx

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

imports: nx_syscalls.nxnx_tls13.nxnx_tls13_record.nxnx_tls13_read_record_from_fd.nxnx_tls13_client_session.nxnx_http_client.nxnx_chacha20_poly1305.nx

imported by: _dlr_probe.nxnx_acme_directory_live.nxnx_acme_directory_live_real_ca_test.nxnx_acme_http.nxnx_app_monitor.nxnx_aw_verify_gate.nxnx_browser_own_site_live_test.nxnx_cad_verify_gate.nxnx_chrome_fetch_probe.nxnx_connect_live_verify.nxnx_crew_live_verify.nxnx_edge_probe.nxnx_edge_vantage.nxnx_extllm_call.nxnx_fetch_jellyfin_test.nxnx_funcheck.nxnx_gallery_auth_research_fetch.nxnx_golive_dns_gate.nxnx_hf_probe.nxnx_hls_live_probe.nxnx_https_fetch.nxnx_https_fetch_file.nxnx_https_fetch_follow.nxnx_https_fetch_lib.nxnx_https_get.nxnx_https_get_cli.nxnx_https_get_cli2.nxnx_https_get_cli2_candidate.nxnx_https_get_complete_test.nxnx_https_get_live_google_test.nxnx_https_get_live_real_ca_test.nxnx_https_post_complete.nxnx_https_truncation_gate.nxnx_hub_lib_verify_gate.nxnx_hub_verify_gate.nxnx_iot_fetch_probe.nxnx_iot_verify_gate.nxnx_kaprobe.nxnx_lib_fetch.nxnx_lib_fetch_cookie.nxnx_library_fetch.nxnx_model_fetch.nxnx_night_fetch_test.nxnx_nist_verify_gate.nxnx_office_live_verify.nxnx_onsite_frontier_fetch.nxnx_onsite_research_fetch.nxnx_orch_verify_gate.nxnx_research_fetch_wiki_test.nxnx_scilib_verify_gate.nxnx_sclass_ux_research_fetch.nxnx_semantic_research_fetch.nxnx_site_probe.nxnx_survey_live_verify.nxnx_torrent_live_probe.nxnx_url_probe.nxnx_url_truth_gate.nxnx_uxf_fetch_avro.nxnx_uxf_fetch_protobuf.nxnx_web_crawl_breadth.nxnx_web_crawl_index.nxnx_webpub_fetch.nxnx_ws_client_session.nxnx_yt_innertube.nxnx_zerodt_fetch.nx

structs

none

consts

72const NX_HTTPS_GC_OK: i64 = 1
73const NX_HTTPS_GC_BAD_STATE: i64 = 2
74const NX_HTTPS_GC_BUILD_FAIL: i64 = 3
75const NX_HTTPS_GC_ENCRYPT_FAIL: i64 = 4
76const NX_HTTPS_GC_WRITE_FAIL: i64 = 5
77const NX_HTTPS_GC_READ_FAIL: i64 = 6
78const NX_HTTPS_GC_DECRYPT_FAIL: i64 = 7
79const NX_HTTPS_GC_BUF_OVERFLOW: i64 = 8
80const NX_HTTPS_GC_VERDICT_N: i64 = 9
85const NX_HTTPS_GC_REQ_BUF_BYTES: i64 = 8192
88const NX_HTTPS_GC_RESP_RECORD_BYTES: i64 = 16645
185const NX_HTTPS_BODY_COMPLETE: i64 = 0 // Content-Length declared N and N bytes arrived
186const NX_HTTPS_BODY_TRUNCATED: i64 = 1 // Content-Length declared N, the peer stopped at M < N
187const NX_HTTPS_BODY_UNJUDGEABLE: i64 = 2 // no Content-Length reached us: chunked, or read-to-close
188const NX_HTTPS_BODY_UNOBSERVED: i64 = 3 // the read loop never ran (bad state / build / write fail)

functions

90func nx_https_gc_verdict_is_valid(v: i64) -> i64
called by 1: main
96func _gc_pn(v: i64) -> i64
109func _gc_write_n(fd: i64, buf: *u8, n: i64) -> i64
called by 1: _gc_req_core calls 1: sys_write
123func _gc_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: _gc_ci_match
125func _gc_hdr_end(buf: *u8, n: i64) -> i64
134func _gc_ci_match(buf: *u8, off: i64, end: i64, pat: *u8, patlen: i64) -> i64
called by 2: hgc_hdr_chunked_gc_clen calls 1: _gc_lc
142func _gc_clen(buf: *u8, hdr_end: i64) -> i64
called by 2: _gc_req_corehg_target calls 1: _gc_ci_match
194func nx_https_last_body_state() -> i64 { return gc_body_state_g }
called by 2: mainmain
195func nx_https_last_body_expected() -> i64 { return gc_body_expected_g }
called by 2: mainmain
196func nx_https_last_body_got() -> i64 { return gc_body_got_g }
called by 2: mainmain
203func nx_https_body_state(body_target: i64, accumulated: i64) -> i64
210func nx_https_body_shortfall(body_target: i64, accumulated: i64) -> i64
called by 1: main calls 1: nx_https_body_state
216func _gc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
217func _gc_e(s: *u8) -> i64 { sys_write(2, s, _gc_slen(s)); return 0 }
called by 1: _gc_body_seal calls 2: sys_write_gc_slen
220func _gc_body_seal(body_target: i64, accumulated: i64) -> i64
241func nx_https_req_complete(
260func nx_https_req_prefix(
calls 1: _gc_req_core
269func _gc_req_core(
464func nx_https_get_complete(
514func main() -> i64