From bb74e75a049768c2949aa08de6752a16813b97de Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Mon, 24 Apr 2023 23:24:40 +0200 Subject: feat(ext/http): h2c for http/2 (#18817) This implements HTTP/2 prior-knowledge connections, allowing clients to request HTTP/2 over plaintext or TLS-without-ALPN connections. If a client requests a specific protocol via ALPN (`h2` or `http/1.1`), however, the protocol is forced and must be used. --- ext/net/raw.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'ext/net') diff --git a/ext/net/raw.rs b/ext/net/raw.rs index 74cc10d63..3b50af41e 100644 --- a/ext/net/raw.rs +++ b/ext/net/raw.rs @@ -30,6 +30,25 @@ pub enum NetworkStream { Unix(#[pin] UnixStream), } +impl From for NetworkStream { + fn from(value: TcpStream) -> Self { + NetworkStream::Tcp(value) + } +} + +impl From for NetworkStream { + fn from(value: TlsStream) -> Self { + NetworkStream::Tls(value) + } +} + +#[cfg(unix)] +impl From for NetworkStream { + fn from(value: UnixStream) -> Self { + NetworkStream::Unix(value) + } +} + /// A raw stream of one of the types handled by this extension. #[derive(Copy, Clone, PartialEq, Eq)] pub enum NetworkStreamType { -- cgit v1.2.3