wt_h3 (webtransport v0.2.3)
View SourceHTTP/3 WebTransport protocol helpers.
This module bridges the generic HTTP/3 connection layer from quic_h3 with WebTransport-specific session negotiation and capsule handling.
Summary
Functions
Send a CLOSE_WEBTRANSPORT_SESSION capsule on the CONNECT stream.
Return default H3 settings for the given compatibility mode.
Determine the compat mode (latest or legacy) from incoming CONNECT headers.
Send a DRAIN_WEBTRANSPORT_SESSION capsule to signal graceful shutdown.
Return true if the response headers contain a 2xx status code.
Build WebTransport CONNECT request headers for the latest draft.
Build WebTransport CONNECT request headers with additional custom headers.
Build WebTransport CONNECT request headers for the specified compat mode.
Send a WebTransport CONNECT request on the H3 connection, returning the stream ID.
Send a WebTransport CONNECT request using the given compat mode.
Extract the numeric HTTP status code from response headers.
Encode and send a capsule on the CONNECT stream for the given session.
Check that the peer advertises WebTransport support (latest draft).
Check that the peer advertises WebTransport support for the given compat mode.
Types
Functions
-spec close_session(pid(), non_neg_integer(), non_neg_integer(), binary()) -> ok | {error, term()}.
Send a CLOSE_WEBTRANSPORT_SESSION capsule on the CONNECT stream.
-spec default_settings() -> map().
-spec default_settings(compat_mode()) -> map().
Return default H3 settings for the given compatibility mode.
-spec detect_compat_mode(headers()) -> {ok, compat_mode()} | {error, term()}.
Determine the compat mode (latest or legacy) from incoming CONNECT headers.
-spec drain_session(pid(), non_neg_integer()) -> ok | {error, term()}.
Send a DRAIN_WEBTRANSPORT_SESSION capsule to signal graceful shutdown.
Return true if the response headers contain a 2xx status code.
Build WebTransport CONNECT request headers for the latest draft.
Build WebTransport CONNECT request headers with additional custom headers.
-spec request_headers(binary(), binary(), headers(), compat_mode()) -> headers().
Build WebTransport CONNECT request headers for the specified compat mode.
-spec request_session(pid(), binary(), binary(), headers()) -> {ok, non_neg_integer()} | {error, term()}.
Send a WebTransport CONNECT request on the H3 connection, returning the stream ID.
-spec request_session(pid(), binary(), binary(), headers(), compat_mode()) -> {ok, non_neg_integer()} | {error, term()}.
Send a WebTransport CONNECT request using the given compat mode.
-spec response_status(headers()) -> {ok, non_neg_integer()} | {error, term()}.
Extract the numeric HTTP status code from response headers.
-spec send_capsule(pid(), non_neg_integer(), wt_h3_capsule:capsule()) -> ok | {error, term()}.
Encode and send a capsule on the CONNECT stream for the given session.
Check that the peer advertises WebTransport support (latest draft).
-spec validate_wt_support(pid(), pid(), compat_mode()) -> ok | {error, term()}.
Check that the peer advertises WebTransport support for the given compat mode.