Skip to main content

read_bounded

Function read_bounded 

Source
pub fn read_bounded(
    reader: &mut dyn Read,
    limit: Option<NonZeroU64>,
) -> Result<Body>
Expand description

Reads a request body, stopping at limit bytes.

None reads the whole body, which is what a node with no push ceiling does. With a ceiling, at most limit + 1 bytes are ever held: the one extra byte is how “exactly at the ceiling” is told from “over it”.

§Errors

Propagates a read failure from the socket. A failure while draining an over-limit body is deliberately not propagated — the client has already lost, and answering it beats reporting how it hung up.