Expand description
Body wrappers for streaming upstream responses.
Both operate at the http_body::Body frame level so they compose with any
BoxBody<Bytes, BoxError> — the streaming body type used throughout
src/outbound and src/context/stream.rs — without re-buffering it.
BoxError (crate::outbound::BoxError) is a boxed std::error::Error,
not hyper::Error: see that type alias’s doc comment for why. In short,
hyper::Error has no public constructor anywhere in the hyper crate, so
a body wrapper built on it could never report its own failure. BoxError
has no such restriction, which is what lets idle_timeout_body below
actually error the stream on reap, rather than merely ending it.
Structs§
- Body
Holding 🔒 - Idle
Timeout 🔒Body - Idle
Timeout Error - The error
idle_timeout_bodyreports when a stream is reaped: no frame arrived for the configured idle bound.
Functions§
- body_
holding - Wraps
bodysoguardsare dropped only when the body reports it has finished (cleanly or with an error) or the returned body is itself dropped — never merely because the node that started the stream returned. This is what keeps balancer in-flight counters andlimit-connpermits held for the stream’s real lifetime. - idle_
timeout_ body - Wraps
bodyso it errors when no frame arrives foridle. The timer resets on every frame, so a steady stream survives indefinitely while a silent one is reaped — and reaped as a real failure (Poll::Ready(Some(Err(IdleTimeoutError)))), not a clean end: ending cleanly would write the chunked terminator (HTTP/1.1) orEND_STREAM(h2) exactly as a legitimately complete response would, making a truncated body indistinguishable from a complete one on the wire — on exactly the unbounded bodies (NDJSON exports, log tails, bulk proxied data) this feature targets. A real upstream error — the wrapped body itself yieldingErr, e.g. a connection reset — is forwarded unchanged; the reap only fires when nothing else has.