Skip to main content

read_response_capped

Function read_response_capped 

Source
pub async fn read_response_capped(
    response: Response,
    limit: usize,
) -> Result<Bytes>
Expand description

Prevents a remote peer from forcing unbounded response-body allocation.

An advertised Content-Length above limit is rejected before the body buffer is allocated. The streaming loop enforces the same bound when the length is absent or inaccurate.