Skip to main content

read_bounded

Function read_bounded 

Source
async fn read_bounded(
    client_id: &str,
    response: Response,
) -> Result<Vec<u8>, ClientMetadataError>
Expand description

Reads at most MAX_DOCUMENT_BYTES of a response body.

A declared Content-Length over the bound is refused without reading anything; a body that lies about its length, or declines to declare one, is refused the moment it crosses the bound. Neither path ever holds more than one chunk past MAX_DOCUMENT_BYTES in memory.