To implement an HTTP/3 server, you use the server::Connection type. The process involves taking a QUIC endpoint listener and performing a handshake to set up required HTTP/3 streams (control streams, QPACK, etc.).
Handshake
You can perform a handshake using the default configuration:
server::handshake(connection).await
Or use a builder to customize settings, such as max_field_section_size:
Connection::builder()
.max_field_section_size(1024 * 32)
.handshake(connection)
.await
Accepting Requests
Once the connection is established, you can accept requests using .accept(). This returns an http::Request and a RequestStream.
// Returns (Request, RequestStream)
let (req, mut stream) = connection.accept().await?;
impl<T: quic::Connection<B>, B: Buf> Connection<T, B> {
pub async fn accept(&mut self)
-> Result<(Request<()>, RequestStream<T::BidiStream, B>), Error>;
}