Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions h3/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ impl Protocol {
pub const CONNECT_UDP: Protocol = Protocol(ProtocolInner::ConnectUdp);
/// RFC 9484 protocol
pub const CONNECT_IP: Protocol = Protocol(ProtocolInner::ConnectIp);
/// RFC 9220 (WebSocket) protocol
pub const WEBSOCKET: Protocol = Protocol(ProtocolInner::WebSocket);

/// Return a &str representation of the `:protocol` pseudo-header value
#[inline]
Expand All @@ -23,6 +25,7 @@ impl Protocol {
ProtocolInner::WebTransport => "webtransport",
ProtocolInner::ConnectUdp => "connect-udp",
ProtocolInner::ConnectIp => "connect-ip",
ProtocolInner::WebSocket => "websocket",
}
}
}
Expand All @@ -32,6 +35,7 @@ enum ProtocolInner {
WebTransport,
ConnectUdp,
ConnectIp,
WebSocket,
}

/// Error when parsing the protocol
Expand All @@ -45,6 +49,7 @@ impl FromStr for Protocol {
"webtransport" => Ok(Self(ProtocolInner::WebTransport)),
"connect-udp" => Ok(Self(ProtocolInner::ConnectUdp)),
"connect-ip" => Ok(Self(ProtocolInner::ConnectIp)),
"websocket" => Ok(Self(ProtocolInner::WebSocket)),
_ => Err(InvalidProtocol),
}
}
Expand Down
Loading