Skip to main content

Module http

Module http 

Source
Expand description

The shared HTTP agent (REQ-31), the error type the clients return, and the retry after HTTP 401 (REQ-22).

Modules§

status
The HTTP statuses the clients map, named so the mapping code holds no bare numbers.

Structs§

InvalidUrl
The supplied service URL was not a plain HTTPS origin and path.

Enums§

Error
A failed request. No variant holds a credential.

Constants§

ERROR_BODY_BYTES
The body limit for an error message or another small body (64 KiB).
MAX_BODY_BYTES
The body limit for a response that may be large (64 MiB).
TIMEOUT

Functions§

agent
One agent for every client: the platform certificate store (so a proxy certificate the system trusts is accepted), HTTPS_PROXY and NO_PROXY from the environment, and a 30 s timeout. A failure status is returned as a response, so a client can read the service’s error message.
plain_https_url
Checks a service base URL: https, no credentials, query or fragment. Returns the origin and path without a trailing slash.
send_with_retry
Sends a request with a credential from credential. After HTTP 401 it drops the credential, gets one again and retries once (REQ-22). A second 401 also drops the credential and is returned to the caller.