pub struct H3BidiRequest<Transport, Handler> { /* private fields */ }Expand description
A pending HTTP/3 request-response cycle on one bidirectional stream, with optional per-stream hooks.
Built by H3Connection::process_inbound_bidi. Configure hooks with the with_*
methods and .await it to run the cycle. New per-stream extension points are added as
further with_* methods, so the entry point’s required arguments never change.
Implementations§
Source§impl<Transport, Handler> H3BidiRequest<Transport, Handler>
impl<Transport, Handler> H3BidiRequest<Transport, Handler>
Sourcepub fn with_reset<R>(self, reset: R) -> Self
pub fn with_reset<R>(self, reset: R) -> Self
Issue a stream RST on a stream-level protocol error.
On any H3Error::Protocol(code) from first-frame processing, reset is called with
the still-owned transport and the error code before the error is returned — letting the
caller RST both halves of the bidi stream as RFC 9114 requires. I/O errors and
successful runs do not invoke it. Without this hook, the transport is dropped without a
reset.
Sourcepub fn with_request_rejection(self) -> Self
pub fn with_request_rejection(self) -> Self
Treat an HTTP request on this stream as a protocol violation instead of running the handler.
A peer that accepts inbound bidirectional streams only for negotiated extensions —
an HTTP/3 client, where RFC 9114 makes a server-initiated request stream a connection
error — enables this to refuse requests without responding to them. When the stream’s
first frame begins an HTTP request, the handler is skipped, nothing is written to the
stream, the with_reset hook is invoked with
H3ErrorCode::StreamCreationError, and awaiting resolves to that error. Closing the
connection is the caller’s responsibility, typically inside the reset hook while the
stream is still alive.