Skip to main content

Module client

Module client 

Source

Structs§

AttemptEvent
One attempt about to start, passed to ClientConfig::on_attempt. url has configured and per-request secret values replaced by [redacted] and any query or userinfo removed.
AttemptOutcome
One finished transport hop, reported to Client::on_attempt_outcome exactly once per physical transport attempt that passed the ClientConfig::on_attempt gate, including the terminal one. It is observed before the response body is read. Sanitized like every other event surface: url has configured and per-request secret values replaced by [redacted] and any query or userinfo removed, headers are a copy with credential-named values (including Set-Cookie and Authorization) replaced and recorded secret values scrubbed, error text is scrubbed the same way, and no body ever appears. attempt groups redirect hops within one retry. delivery describes only this hop (a refused connect on a redirect hop is NotSent for that hop): a later NotSent never makes an earlier responded POST safe to replay, and the call’s error and retry decision still treat the whole redirect chain as possibly delivered. Redirect responses report before target validation; their next_delay is None. Only the final hop can carry a retry delay. A pre-send validation or policy refusal reports no outcome; earlier hop outcomes remain available.
Client
ClientConfig
ProxyDiagnostic
What a client knows about the proxy it uses, for diagnostics. Credentials are never part of it.
Request
Response
ResponseHead
Status line and headers of a response whose body was not read; see Client::send_headers.
RetryEvent
One retry decision, reported to ClientConfig::on_retry. url and reason have configured and per-request secret values replaced by [redacted].
StreamResponse

Enums§

AttemptDelivery
What became of one attempt’s bytes, for AttemptOutcome. It tells a caller whether replaying a non-idempotent request could repeat a side effect.
Method
ProxyMode
How requests reach the network.
ProxyModeUsed
Which proxy source a client actually ended up with, as opposed to the ProxyMode it was asked for. Differs from the request only for ProxyMode::System when the operating system configures automatic detection and nothing else.
TrustRoots
Which certificate roots verify a server’s TLS certificate.

Functions§

form_encode
percent_decode
percent_decode_component
Inverse of percent_encode_component: decodes %XX escapes and leaves + as written. An escape that is not two hex digits is kept as written; invalid UTF-8 is replaced.
percent_encode
Percent-encode for application/x-www-form-urlencoded / URL query values.
percent_encode_component
RFC 3986 percent-encoding for one URL path segment or query value. Unreserved bytes (A-Z a-z 0-9 - . _ ~) are kept, a space becomes %20 (never +), and every other byte becomes %XX. Use percent_encode only for application/x-www-form-urlencoded bodies.