Skip to main content

Module client

Module client 

Source
Expand description

The HTTP client every request Ojak sends goes through.

An ActivityPub server fetches and posts to URLs other servers name, so anything that reaches its network is reachable by anyone who can name a URL. This client refuses the addresses a public server has no business contacting — loopback, private, link-local, shared and reserved ranges — and it decides on the addresses DNS returns, after resolution, so that a name that passed a check cannot be pointed somewhere else before the connection is made. Literal IP addresses in a URL, and every hop of a redirect, are checked the same way.

An application running against a peer on its own network, in development or tests, allows that network explicitly with ClientConfig::allow_private.

Structs§

Client
The guarded client. Cheap to clone; clones share a connection pool.
ClientConfig
How the client behaves.
Response
A response, read in full.

Enums§

RequestError
Why a request was not answered.

Functions§

is_public
Whether address is on the public internet.
validate_url
Check a URL before requesting it: its scheme, and its host when the host is a literal address, which DNS never sees.