pub async fn run_with_initial_bytes<Transport, Handler, Fut>(
context: Arc<HttpContext>,
transport: Transport,
initial_bytes: Vec<u8>,
handler: Handler,
) -> Result<Option<Upgrade<Transport>>>Expand description
Like HttpContext::run, but starts with the supplied bytes pre-filled into the request
buffer.
For adapters that peek the first few bytes off a cleartext TCP stream to decide between HTTP/1.1 and HTTP/2 prior-knowledge dispatch, then need to hand those bytes into the HTTP/1 parser without re-reading. Bytes already in the buffer are consumed by the parser before any transport read happens.
§Errors
Same as HttpContext::run — any irrecoverably malformed or noncompliant HTTP/1 request
surfaces as an Error.