Skip to main content

read_request

Function read_request 

Source
pub fn read_request<R: Read>(
    stream: &mut BufReader<R>,
    max_body: usize,
) -> Result<Request, HttpError>
Expand description

Reads one HTTP/1.x request off stream, decoding a chunked body if Transfer-Encoding: chunked is present, or reading exactly Content-Length bytes otherwise. Neither may exceed max_body.

§Errors

See HttpError. HttpError::ConnectionClosed specifically means zero bytes arrived before any request line — the expected way a keep-alive loop’s next read ends.