Skip to main content

decode_request

Function decode_request 

Source
pub fn decode_request(
    input: &[u8],
    limits: Limits,
) -> Result<(RequestHead<'_>, usize), DecodeError>
Expand description

Decodes a request head. Returns it and the octets it used, the empty line included; the body, if any, starts there.

Empty lines before the request line are skipped (RFC 9112 §2.2).

§Errors

DecodeError::Incomplete before the empty line; TooLarge "head" when none is found within Limits::max_head_bytes (leading empty lines count), TooLarge "field count" past Limits::max_fields; Malformed naming the rule otherwise ("version" for a version other than HTTP/1.1 and HTTP/1.0).