Skip to main content

Module h3api

Module h3api 

Source
Expand description

The facade over the HTTP/3 layer.

Everything the rest of the crate needs from HTTP/3 is named here, and only here: conn, quic and the tunnels use bytes and quinn types plus the handful of names below. That facade began as insulation from the h3 crate; it survives the move to crate::h3 because it is worth having on its own terms – it is the list of what a proxy actually asks of HTTP/3, and it is short.

The vocabulary of an HTTP message – Request, Status, Fields – is crate::h3::message’s and is re-exported here rather than wrapped: a status is a status, and a second type in front of it would say nothing the first does not. The rule is about where they are named, and it is unchanged: nothing outside crate::h3 reaches into it, so this module is the one place that has to be read to know what the rest of the crate may assume about HTTP/3.

Inbound HTTP Datagrams (RFC 9297) are named here too, because the routing they need is per request stream: a datagram carries the Quarter Stream ID of the stream it belongs to, so the layer that owns request streams is the layer that can hand it to the right one. A session claims its share with Stream::datagrams and holds it for as long as it holds the DatagramReceiver (D79). Sending is the one half that stays outside: tunnel::udp writes datagrams straight onto the quinn::Connection it already holds for the send-buffer and datagram-size questions it asks per packet.

Re-exports§

pub use crate::h3::MAX_FIELD_SECTION_SIZE;
pub use crate::h3::connection::Connection;
pub use crate::h3::connection::DatagramReceiver;
pub use crate::h3::error::Code;
pub use crate::h3::error::ConnectionError;
pub use crate::h3::error::StreamError;
pub use crate::h3::message::FieldValue;
pub use crate::h3::message::Fields;
pub use crate::h3::message::Method;
pub use crate::h3::message::Request;
pub use crate::h3::message::Status;
pub use crate::h3::stream::Reader;
pub use crate::h3::stream::Resolver;
pub use crate::h3::stream::RespondError;
pub use crate::h3::stream::Stream;
pub use crate::h3::stream::Writer;

Enums§

BenignClose
How a connection ended, when it ended with an error not worth a warning.

Constants§

AUTH_FAILURE_LIMIT_CODE
Connection close code used when a peer exhausts its authentication attempts.
CONNECT_ERROR
The proxy’s connection to the target failed or was reset (RFC 9114 §8.1).
DATAGRAM_ERROR
A datagram or capsule could not be parsed (RFC 9297 §5.2).
MESSAGE_ERROR
The peer sent something malformed (RFC 9114 §8.1).
NO_ERROR
No error – a clean teardown.
REQUEST_CANCELLED
The request or its response is cancelled (RFC 9114 §8.1).

Functions§

benign_close
Classifies a connection-level error that is an ordinary goodbye rather than a failure, or None if it deserves a warning.
peer_reset_code
The reset code the peer used, if this error is a peer-initiated reset.