11use core:: hash:: { Hash , Hasher } ;
22
3+ use super :: { connect:: Connect , tls:: TlsStream , uri:: Uri } ;
4+ use crate :: request:: SniHostname ;
35use xitca_http:: http:: uri:: { Authority , PathAndQuery } ;
4-
5- use super :: { tls:: TlsStream , uri:: Uri } ;
6+ use xitca_unsafe_collection:: bytes:: BytesStr ;
67
78/// exclusive connection for http1 and in certain case they can be upgraded to [ConnectionShared]
89pub type ConnectionExclusive = TlsStream ;
@@ -34,10 +35,17 @@ impl From<crate::h3::Connection> for ConnectionShared {
3435#[ doc( hidden) ]
3536#[ derive( PartialEq , Eq , Debug , Clone , Hash ) ]
3637pub enum ConnectionKey {
37- Regular ( Authority ) ,
38+ Regular ( AuthorityWithSni ) ,
3839 Unix ( AuthorityWithPath ) ,
3940}
4041
42+ #[ doc( hidden) ]
43+ #[ derive( PartialEq , Eq , Debug , Clone , Hash ) ]
44+ pub struct AuthorityWithSni {
45+ authority : Authority ,
46+ sni : Option < SniHostname > ,
47+ }
48+
4149#[ doc( hidden) ]
4250#[ derive( Eq , Debug , Clone ) ]
4351pub struct AuthorityWithPath {
@@ -58,10 +66,13 @@ impl Hash for AuthorityWithPath {
5866 }
5967}
6068
61- impl From < & Uri < ' _ > > for ConnectionKey {
62- fn from ( uri : & Uri < ' _ > ) -> Self {
63- match * uri {
64- Uri :: Tcp ( uri) | Uri :: Tls ( uri) => ConnectionKey :: Regular ( uri. authority ( ) . unwrap ( ) . clone ( ) ) ,
69+ impl From < & Connect < ' _ > > for ConnectionKey {
70+ fn from ( connect : & Connect < ' _ > ) -> Self {
71+ match connect. uri {
72+ Uri :: Tcp ( uri) | Uri :: Tls ( uri) => ConnectionKey :: Regular ( AuthorityWithSni {
73+ authority : uri. authority ( ) . unwrap ( ) . clone ( ) ,
74+ sni : connect. sni_hostname . cloned ( ) ,
75+ } ) ,
6576 Uri :: Unix ( uri) => ConnectionKey :: Unix ( AuthorityWithPath {
6677 authority : uri. authority ( ) . unwrap ( ) . clone ( ) ,
6778 path_and_query : uri. path_and_query ( ) . unwrap ( ) . clone ( ) ,
0 commit comments