http: support ALPN negotiated http2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2024-03-28 11:19:56 +01:00
parent d73eb3dcf1
commit 9be9d4b6ab

View File

@ -87,7 +87,14 @@ impl<S: Connection + AsyncRead + AsyncWrite + Unpin> Connection for MaybeTlsStre
match self {
MaybeTlsStream::Normal(s) => s.connected(),
MaybeTlsStream::Proxied(s) => s.connected().proxy(true),
MaybeTlsStream::Secured(s) => s.get_ref().connected(),
MaybeTlsStream::Secured(s) => {
let connected = s.get_ref().connected();
if s.ssl().selected_alpn_protocol() == Some(b"h2") {
connected.negotiated_h2()
} else {
connected
}
}
}
}
}