Skip to main content

Module http

Module http 

Source
Expand description

HTTP/1.1 as pure functions, with no input or output (doc 19a, section 18.10.3): building the request, interpreting the response (Content-Length, chunked or until the connection ends) and reading the address. The transport (TCP, TLS) only carries bytes back and forth.

Structs§

Request
Response
Url
A server’s address, read from http://host:port or https://host:port/prefix.

Enums§

ReadError

Constants§

MAX_BODY
Cap on a response body: a batch of large base64 messages fits with room to spare.

Functions§

build_target
Path plus query (/topics/x/messages?maxMessages=2). The path segments already come encoded by the caller.
encode_request
The request bytes. Adds Host, Content-Length and Connection: close.
percent_encode
Encodes a query component: only A-Za-z0-9-._~ passes as is.
read_response
Reads a complete response. 1xx responses are skipped.