pub struct Http3<Io> { /* private fields */ }h3 only.Expand description
An HTTP/3 connection handler.
Http3 wraps a QUIC connection (Io) and drives the HTTP/3 server
connection over the native transport stack. It supports:
- Concurrent request stream handling
- Streaming request/response bodies and trailers
- Automatic
100 Continueand103 Early Hintsinterim responses - Per-connection
Dateheader caching - Graceful shutdown via a
CancellationToken
§Construction
let http3 = Http3::new(quic_connection, Http3Options::default());§Serving requests
Use the HttpProtocol trait methods (handle /
handle_with_error_fn) to drive the
connection to completion.
Implementations§
Source§impl<Io> Http3<Io>where
Io: Connection + Unpin + 'static,
impl<Io> Http3<Io>where
Io: Connection + Unpin + 'static,
Sourcepub fn new(io: Io, options: Http3Options) -> Self
pub fn new(io: Io, options: Http3Options) -> Self
Creates a new Http3 connection handler wrapping the given QUIC
connection.
The options value controls HTTP/3 protocol configuration, connection
setup and accept timeouts, and optional behaviour such as automatic
100 Continue responses; see Http3Options for details.
§Example
let http3 = Http3::new(quic_connection, Http3Options::default());Sourcepub fn graceful_shutdown_token(self, token: CancellationToken) -> Self
pub fn graceful_shutdown_token(self, token: CancellationToken) -> Self
Attaches a CancellationToken for graceful shutdown.
When the token is cancelled, the handler sends an HTTP/3 graceful shutdown signal (GOAWAY), stops accepting new request streams, and exits cleanly once the in-flight requests have drained.