Skip to main content

peek_http_input_with_timeout_policy

Function peek_http_input_with_timeout_policy 

pub async fn peek_http_input_with_timeout_policy<PeekableInput>(
    input: PeekableInput,
    timeout: Option<Duration>,
    timeout_policy: PeekTimeoutPolicy,
) -> 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 with an explicit timeout policy and return an input that replays every byte consumed during detection.

A definitive non-HTTP prefix returns Ok((None, input)) under either policy. An inconclusive timeout returns PeekTimeoutError when PeekTimeoutPolicy::FailClosed is selected.