httpclient

HTTP Client Helpers

Functions

FunctionDescription
_hcli_byte_atInternal byte reader.
_hcli_copyInternal: copy bytes.
_hcli_parse_intInternal: parse integer from ASCII digits at position.
_hcli_find_bodyInternal: find double CRLF. Returns offset of body start or -1.
_hcli_lowerInternal: compare bytes case-insensitively.
_hcli_eq_nocase
http_parse_responseParse an HTTP response. Returns handle.
http_resp_statusGet status code.
http_resp_headerGet a header value. Searches for “Name: value\r\n”. Returns length of value c…
http_resp_body_offsetGet body start offset.
http_resp_body_lenGet body length.
http_build_get_requestBuild a GET request. Returns total length in out.

Details

_hcli_byte_at

fn _hcli_byte_at(buf: &i8, idx: i64) -> i64

Internal byte reader.

_hcli_copy

fn _hcli_copy(dst: &i8, doff: i64, src: &i8, soff: i64, len: i64) -> i64

Internal: copy bytes.

_hcli_parse_int

fn _hcli_parse_int(buf: &i8, off: i64, len: i64) -> i64

Internal: parse integer from ASCII digits at position.

_hcli_find_body

fn _hcli_find_body(buf: &i8, len: i64) -> i64

Internal: find double CRLF. Returns offset of body start or -1.

_hcli_lower

fn _hcli_lower(ch: i64) -> i64

Internal: compare bytes case-insensitively.

_hcli_eq_nocase

fn _hcli_eq_nocase(a: &i8, aoff: i64, b: &i8, boff: i64, len: i64) -> i64

http_parse_response

fn http_parse_response(buf: &i8, len: i64) -> &i64

Parse an HTTP response. Returns handle.

http_resp_status

fn http_resp_status(h: &i64) -> i64

Get status code.

http_resp_header

fn http_resp_header(h: &i64, name: &i8, nlen: i64, out: &i8) -> i64

Get a header value. Searches for “Name: value\r\n”. Returns length of value copied to out, or -1 if not found.

http_resp_body_offset

fn http_resp_body_offset(h: &i64) -> i64

Get body start offset.

http_resp_body_len

fn http_resp_body_len(h: &i64) -> i64

Get body length.

http_build_get_request

fn http_build_get_request(host: &i8, hlen: i64, path: &i8, plen: i64, out: &i8) -> i64

Build a GET request. Returns total length in out.