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_peer_gone(self, peer_gone: PeerGone) -> Self
pub fn with_peer_gone(self, peer_gone: PeerGone) -> Self
Report peer abandonment of this stream — STOP_SENDING, stream reset, or connection
loss — to Conn::is_disconnected, Conn::cancel_on_disconnect, and
Upgrade::poll_closed.
QUIC signals departure out-of-band rather than through the byte stream, and an h3 client half-closes its send side as soon as the request is complete, so reading the transport can neither detect abandonment nor be used as a proxy for it. Without this hook those three APIs never report a disconnection on HTTP/3.
The future must resolve only on abandonment: an h3 request stream is not finished by
the peer under normal operation, so a future that also resolves on orderly completion
(as quinn::SendStream::stopped does) is only correct if it is derived from the send
half of a stream this connection has not yet finished.
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.