Marathon.HttpClient
Native HTTP/1.1-over-TLS client. Replaces the curl shell-out now that march's compiled TLS client works (the tls_write codegen bug is fixed upstream). march's high-level HttpClient/HttpTransport still don't link natively (they need an http_fetch builtin that only exists on the js/interpreter path), so this builds the request+response directly over the Tls module's connect/write/read.
Framing: sends Connection: close; reads to EOF collecting chunks (O(n), joined once). Completeness is enforced — a Content-Length short of the received body, a non-clean close on a close-delimited body, or Transfer-Encoding: chunked all return Err rather than silently handing back a truncated/mis-framed payload. Provider-agnostic; the pure codec is unit-tested. Internal to marathon — used by the Mailgun adapter's HTTPS transport.
Functions
Build a raw HTTP/1.1 request. headers is a list of (name, value) pairs; Host, Content-Length (byte size of body) and Connection: close are added automatically. Method/path/host/header names+values are CR/LF-stripped to prevent header injection; the body is sent verbatim. Pure.
Frame a raw response into Ok({status, body}) or Err. Enforces Content-Length (short body -> Err), rejects Transfer-Encoding: chunked (unsupported -> Err, never silent framing bytes), and for a close-delimited body requires a clean EOF. Pure.
Case-insensitive lookup of a response header value (\
Parse the numeric status code from a raw response's status line (\
Send an HTTP(S) request. url is a full http:// or https:// URL (host + optional :port, default 443 for https / 80 for http); headers is a list of (name, value) pairs; body is the request body (\
The response body — everything after the first CRLF-CRLF (header/body separator). \