nx_http_response_parse_candidate.nx
buildroot/runtime/nx_http_response_parse_candidate.nx
about
nx_http_response_parse.nx -- client-side HTTP/1.1 response parser.
Parses the bytes that come back over a TLS record stream into:
- status_code (integer, e.g. 200)
- reason_offset (byte offset of reason phrase in input)
- reason_len
- headers_offset (byte offset of first header line)
- headers_len (bytes covering all headers, EXCLUDING the
blank line terminator)
- body_offset (byte offset of body start in input, after
the CRLF CRLF boundary)
- body_len (Content-Length value if present and decoded,
else 0 -- callers can dechunk explicitly via
nx_http_dechunk)
- transfer_kind (NX_HTTP_BODY_CONTENT_LENGTH | NX_HTTP_BODY_
CHUNKED | NX_HTTP_BODY_UNTIL_CLOSE | NX_HTTP
_BODY_EMPTY)
Field accessors (case-insensitive header name match):
nx_http_response_header(parsed, name, name_len, val_off, val_len)
Chunked decoder (RFC 7230 ยง4.1):
nx_http_dechunk(src, src_len, out, out_cap) -> decoded_len
Built per F7 post-order DFS: callees defined before callers.
Built per F6 size discipline: <12 lets per function.
expect_exit: 0
license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_https_get_cli2_candidate.nx
structs
| none |
consts
| 35 | const NX_HTTP_RESP_OK: i64 = 0 |
| 36 | const NX_HTTP_RESP_ERR_TOO_SHORT: i64 = 1 |
| 37 | const NX_HTTP_RESP_ERR_BAD_STATUS_LINE: i64 = 2 |
| 38 | const NX_HTTP_RESP_ERR_BAD_VERSION: i64 = 3 |
| 39 | const NX_HTTP_RESP_ERR_BAD_CODE: i64 = 4 |
| 40 | const NX_HTTP_RESP_ERR_NO_BODY_SEP: i64 = 5 |
| 41 | const NX_HTTP_RESP_ERR_HEADER_OVERFLOW: i64 = 6 |
| 42 | const NX_HTTP_RESP_ERR_BAD_CHUNK_SIZE: i64 = 7 |
| 43 | const NX_HTTP_RESP_ERR_TRUNCATED: i64 = 8 |
| 45 | const NX_HTTP_BODY_EMPTY: i64 = 0 |
| 46 | const NX_HTTP_BODY_CONTENT_LENGTH: i64 = 1 |
| 47 | const NX_HTTP_BODY_CHUNKED: i64 = 2 |
| 48 | const NX_HTTP_BODY_UNTIL_CLOSE: i64 = 3 |
functions
| 58 | func nx_http_resp_is_digit(c: i64) -> i64 |
| 63 | func nx_http_resp_is_hex(c: i64) -> i64 calls 1: nx_http_resp_is_digit |
| 71 | func nx_http_resp_lower(c: i64) -> i64 called by 1: nx_http_resp_cieq |
| 77 | func nx_http_resp_hex_val(c: i64) -> i64 |
| 85 | func nx_http_resp_cieq(a: *u8, a_len: i64, b: *u8, b_len: i64) -> i64 |
| 99 | func nx_http_resp_find_byte(src: *u8, src_len: i64, off: i64, c: i64) -> i64 called by 1: nx_http_resp_parse_header_line |
| 109 | func nx_http_resp_find_crlf(src: *u8, src_len: i64, off: i64) -> i64 |
| 121 | func nx_http_resp_find_crlfcrlf(src: *u8, src_len: i64, off: i64) -> i64 |
| 139 | func nx_http_resp_parse_dec(src: *u8, src_len: i64, off: i64, out_end: *i64) -> i64 called by 2: nx_http_resp_parse_status_linenx_http_resp_classify_body calls 1: nx_http_resp_is_digit |
| 161 | func nx_http_resp_parse_hex(src: *u8, src_len: i64, off: i64, out_end: *i64) -> i64 calls 1: nx_http_resp_hex_val |
| 183 | func nx_http_resp_skip_ows(src: *u8, src_len: i64, off: i64) -> i64 |
| 201 | func nx_http_resp_parse_status_line( |
| 244 | func nx_http_resp_parse_header_line( |
| 304 | func nx_http_resp_alloc() -> *i64 { return sys_mmap(128) as *i64 } calls 1: sys_mmap |
| 308 | func nx_http_resp_classify_body(src: *u8, src_len: i64, r: *i64) -> i64 |
| 358 | func nx_http_response_parse(src: *u8, src_len: i64, r: *i64) -> i64 |
| 396 | func nx_http_response_header( |
| 434 | func nx_http_dechunk(src: *u8, src_len: i64, out: *u8, out_cap: i64) -> i64 |