Expand description
One constructor for every outbound reqwest client this workspace
builds. A client with no timeout waits forever on a black-holed route.
The workspace’s clippy.toml disallows reqwest’s own constructors, so
a client built anywhere else fails the lint. A caller that needs another
total deadline, such as a held poll, sets it on the builder this returns;
the connect timeout stays.
read_bounded is the other half: a timeout bounds how long a
response may take, not how much of it a caller will hold in memory.
.json() on an unbounded body is a memory sink against any server this
process does not run – an operator’s PDS, or whoever a DID document
points at.
REFUSED_BLOCKS is the third: which addresses an outbound fetch may
reach at all. A URL named by a stranger, or by a document this server
just fetched, is aimed by somebody else; resolve_public and
pinned_client are how it stays aimed at the public internet.
EXTRA_CA_CERTS is the fourth: which authorities a client here
trusts on top of the ones it is built with.
doh is DNS over HTTPS, one GET through a pinned client, for the
records a stub resolver has no API for.
lookup_host is how every client here resolves a name: RFC 6761’s
localhost names go to loopback, and the rest go to the system.
Modules§
- address 🔒
- The one list of address blocks this workspace will not fetch from, and the resolution that enforces it.
- doh
- DNS over HTTPS, for the records a stub resolver has no API for: a zone’s nameservers, a handle’s TXT record, a lexicon authority’s TXT record.
- resolve 🔒
- Name resolution for every client built here.
- test_
support - A server that has stopped answering, for tests of a client’s timeouts.
Enums§
- Address
Error - Why an address check did not let a fetch proceed.
- Private
Addresses - Whether a caller accepts a host that resolves into
REFUSED_BLOCKS. - Read
Bounded Error - Why
read_boundeddid not return a body.
Constants§
- DEFAULT_
CONNECT_ TIMEOUT - How long establishing a connection – DNS, then the TCP and TLS
handshake – may take, independent of
DEFAULT_TIMEOUT. - DEFAULT_
TIMEOUT - The total deadline – connect, send the request, and read the response – for a request to a server this deployment does not run: an operator’s PDS, a relay, the ACME directory, a client’s own metadata document.
- EXTRA_
CA_ CERTS - The environment variable naming a PEM file of certificate authorities every client built here trusts, on top of the ones it is built with.
- MAX_
JSON_ BODY - The most of one response body this workspace will hold in memory to read it, when the response comes from a server nothing here operates.
- REFUSED_
BLOCKS - The address blocks an outbound fetch is refused for.
Statics§
- PROCESS_
ROOTS 🔒 - Authorities a test added for this process; see
test_support::trust. Empty in anything that is not a test, and read on every build so a test that adds one before its first request is enough.
Functions§
- blocking_
builder builder’s two timeouts on a [reqwest::blocking::ClientBuilder], for a caller with no async runtime to drive the async client on.- body_
text - The body of a bounded read, as text.
- builder
- A [
reqwest::ClientBuilder] pre-configured withDEFAULT_CONNECT_TIMEOUTandDEFAULT_TIMEOUT, for a caller that needs to layer something else on top – a redirect policy, a user agent – before building. - client
- The default outbound client:
builder, built. - extra_
root_ 🔒certificates - The authorities
EXTRA_CA_CERTSnames, or nothing if it is unset. - is_
localhost_ name - Whether
nameislocalhostor a name under it. - is_
loopback - Whether
urlnames this machine and nowhere else. - is_
public_ address - Whether an outbound fetch may reach
address: true unless it falls inREFUSED_BLOCKS. - lookup_
host - Every address
nameanswers to atport: loopback for a localhost name, and the system’s answer for any other. - pinned_
client - A
clientforurl: its host resolved once throughresolve_public, pinned to what it resolved to so the connection cannot land elsewhere, and following no redirect, which would land it elsewhere all the same. - read_
bounded - Reads at most
max_bytesofresponse’s body. - read_
bounded_ blocking read_bounded, for a caller with no async runtime.- refuse_
private_ host resolve_publicfor a caller holding its URL as text, when nothing past the refusal is wanted.- resolve_
public - Every address
url’s host answers to, refused unless every one of them is public.