Http module

Client_Request

structSource

A request. Only url is needed; .{ url = "http://..." } is a GET.

Fields

method: := Method.GET
url: string
http://host[:port]/path?query (or https://), or /path?query relative to the client's base_url.
headers: [] Header_Field
Host, Content-Length and User-Agent are added when missing
body: [] u8
timeout: := -1
Milliseconds for the whole exchange, redirects and reading the body included (0: no limit, -1: the client's timeout).
max_redirects: := -1
Follow 301, 302, 303, 307 and 308 up to this many times (more is an error), or not at all when 0: the 3xx response is returned. -1 is the client's max_redirects. 301, 302 and 303 turn a POST into a GET without a body; 307 and 308 repeat the request. Authorization and Cookie are not sent to another host.
max_response_size: := 64 * 1024 * 1024
The largest body read_text, read_bytes and read_json accept, in bytes. read_some has no limit: it hands the body over in pieces.

See also