Skip to main content

peek_http_input_with_config

Function peek_http_input_with_config 

pub async fn peek_http_input_with_config<PeekableInput>(
    input: PeekableInput,
    config: HttpPeekConfig,
) -> Result<(Option<HttpPeekVersion>, <PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<ReplayReader, <PeekableInput as PeekIoProvider>::PeekIo>>), Box<dyn Error + Sync + Send>>
where PeekableInput: PeekIoProvider, <PeekableInput as PeekIoProvider>::PeekIo: Unpin,
Available on crate feature net only.
Expand description

Detect HTTP using explicit resource limits and return an input that replays every byte consumed during detection.

HTTP/1.0 and HTTP/1.1 are accepted only after a complete request-line containing a valid method token, request target, HTTP/1.<digit> version, and line terminator has been read. An HTTP/0.9 simple-request is accepted as HTTP/1x after GET, a valid request target, and a line terminator. Matching lenient HTTP/1 parsers such as httparse, a bare LF is accepted as line terminator and empty lines before the request-line are skipped (they count toward HttpPeekConfig::max_http1_request_line_size). HTTP/2 is accepted only after its complete client preface, starting at the first byte.