@@ -2,7 +2,7 @@ use core::hash::{Hash, Hasher};
22
33use xitca_http:: http:: uri:: { Authority , PathAndQuery } ;
44
5- use super :: { tls:: TlsStream , uri:: Uri } ;
5+ use super :: { connect :: Connect , tls:: TlsStream , uri:: Uri } ;
66
77#[ cfg( feature = "http1" ) ]
88/// A convince type alias for typing connection without interacting with pool.
@@ -42,10 +42,17 @@ impl From<crate::h3::Connection> for ConnectionShared {
4242#[ doc( hidden) ]
4343#[ derive( PartialEq , Eq , Debug , Clone , Hash ) ]
4444pub enum ConnectionKey {
45- Regular ( Authority ) ,
45+ Regular ( AuthorityWithSni ) ,
4646 Unix ( AuthorityWithPath ) ,
4747}
4848
49+ #[ doc( hidden) ]
50+ #[ derive( PartialEq , Eq , Debug , Clone , Hash ) ]
51+ pub struct AuthorityWithSni {
52+ authority : Authority ,
53+ sni : Option < String > ,
54+ }
55+
4956#[ doc( hidden) ]
5057#[ derive( Eq , Debug , Clone ) ]
5158pub struct AuthorityWithPath {
@@ -66,10 +73,13 @@ impl Hash for AuthorityWithPath {
6673 }
6774}
6875
69- impl From < & Uri < ' _ > > for ConnectionKey {
70- fn from ( uri : & Uri < ' _ > ) -> Self {
71- match * uri {
72- Uri :: Tcp ( uri) | Uri :: Tls ( uri) => ConnectionKey :: Regular ( uri. authority ( ) . unwrap ( ) . clone ( ) ) ,
76+ impl From < & Connect < ' _ > > for ConnectionKey {
77+ fn from ( connect : & Connect < ' _ > ) -> Self {
78+ match connect. uri {
79+ Uri :: Tcp ( uri) | Uri :: Tls ( uri) => ConnectionKey :: Regular ( AuthorityWithSni {
80+ authority : uri. authority ( ) . unwrap ( ) . clone ( ) ,
81+ sni : connect. sni_hostname . map ( |s| s. to_string ( ) ) ,
82+ } ) ,
7383 Uri :: Unix ( uri) => ConnectionKey :: Unix ( AuthorityWithPath {
7484 authority : uri. authority ( ) . unwrap ( ) . clone ( ) ,
7585 path_and_query : uri. path_and_query ( ) . unwrap ( ) . clone ( ) ,
0 commit comments