pub struct Timeouts {
pub resolve: Option<Duration>,
pub connect: Option<Duration>,
pub first_byte: Option<Duration>,
pub between_bytes: Option<Duration>,
}Expand description
The timeout triple — wasi:http’s shape, the richest of the ambient
models.
Collapses to a single AbortController in fetch; on native it splits
into connector / response-wait / body-idle. A single Duration throws
away information the WASI backend knows how to use.
Lives in hclient-core because transports read it from the request’s
http::Extensions, and they don’t depend on hclient.
Fields§
§resolve: Option<Duration>A bound on getting an address to try, separate from the connect budget that follows it.
§What it bounds, which is not a phase boundary
Happy Eyeballs interleaves resolution with connecting on purpose —
the resolver is a Stream and hclient-native starts connecting to
the first address while the rest are still arriving — so there is no
instant at which resolution finished, and a bound on one would
have nothing to attach to. What this bounds is the wait for the
first address from either family, which is exactly the failure a
caller cannot otherwise diagnose: a resolver that hangs looks like
an origin that is unreachable, and only the first is worth a
different retry.
It therefore does not apply where the connection does not depend on the resolver — an IP literal, and an HTTPS record carrying address hints, both of which give a connector somewhere to go without an answer.
§Why not simply a smaller connect
Because the two answer different questions and a caller who cares
wants both: resolve says how long may I wait to learn where to
go, connect says and how long may going there take. Folding
them loses which one failed, which is the whole gap. Overlapping
budgets are the caller’s to reconcile; nothing here subtracts one
from the other, because a resolver that answered in 10 ms has not
spent any of the connect budget in any sense a connector can see.
connect: Option<Duration>§first_byte: Option<Duration>§between_bytes: Option<Duration>