Expand description
The one place srv builds an HTTP client.
reqwest 0.13 reads the machine’s certificates when it builds a client, and on Linux it refuses to build one when
there are none (“No CA certificates were loaded from the system”). Client::new() turns that refusal into a panic,
so a server on a machine without ca-certificates died at start. Here a client is always built:
- With system certificates the client trusts exactly them, as before.
- Without any, the client trusts nothing: every https request fails (an untrusted certificate), plain http to the local machine and the LAN keeps working, and the log and the connectivity error say why. Nothing is bundled, no other trust source is read, and no verification is relaxed.
Every client srv builds goes through builder, client_with or client; scripts/check-srv-http-clients.mjs fails CI on a
direct reqwest::Client::new() or reqwest::Client::builder() anywhere else in srv’s own code.
Enums§
- Trust
- What srv’s https requests are checked against on this machine.
Functions§
- builder
- A client builder for srv’s own requests: set what the site needs (timeouts, headers, proxy) and
build(). On a machine with no system certificates it trusts nothing, sobuild()still works. - client
- A client with reqwest’s defaults, for a site that sets nothing. Never fails: the one way a build can fail with nothing to trust is a missing TLS provider, which this module installs itself.
- client_
with - A client built from the site’s own settings (timeouts, headers, redirect rules, proxy), for a site with nowhere to
return an error to. Never fails. The settings come as a function because a builder is used up by
build(), and a build that fails (the certificates the probe saw are gone since: a bundle removed or replaced while the server runs) is tried again with the same settings and nothing to trust, so a site’s redirect rule orno_proxyis never lost and every https request still fails closed. Only if that fails too,clientis the last step. - explain
- What to say when an https request failed: on a machine with no system certificates and a failed certificate check, that there are none and what to install; otherwise the error as it is.
- no_
system_ certs - True on a machine with no system certificates, where every https request fails.
- trust
- What the machine offers, found out once per process. The first call that finds no certificates says so in the log.