pub struct Request { /* private fields */ }Expand description
Implementations§
Source§impl Request
impl Request
Sourcepub async fn accept(conn: Connection) -> Result<Self, Error>
pub async fn accept(conn: Connection) -> Result<Self, Error>
Run the server side of the HTTP/3 handshake: exchange SETTINGS, then take the CONNECT request.
Everything the session later spawns runs on the worker already driving
conn. There is no timeout here; a peer that stalls mid-handshake is
bounded by the connection’s idle timeout.
Sourcepub fn url(&self) -> &Url
pub fn url(&self) -> &Url
The URL the peer connected to; the path and query are what a server
routes and authenticates on. The url crate is
re-exported so naming this type needs no dependency of
your own.
Sourcepub fn protocols(&self) -> &[String]
pub fn protocols(&self) -> &[String]
The subprotocols the peer offered, the WebTransport equivalent of ALPN.
Pick one and name it in respond.
Sourcepub async fn respond(self, response: Response) -> Result<Session, Error>
pub async fn respond(self, response: Response) -> Result<Session, Error>
Accept with a 200, answering as response describes.
Sourcepub async fn reject(self, reason: Rejected) -> Result<(), Error>
pub async fn reject(self, reason: Rejected) -> Result<(), Error>
Refuse with reason, ending the handshake.
Returns once the peer has the response, or after a grace period if it never acknowledges one, and closes the connection deliberately. The HTTP/3 critical streams (the peer’s control and QPACK streams, and ours) stay open until then: RFC 9114 makes closing one a connection error, so tearing them down here would show the peer an H3 failure instead of the status it was sent.