chore: prioritize http3-quinn over http3-s2n when both features are enabled (avoid compile error)

This commit is contained in:
Jun Kurihara 2023-12-09 00:17:59 +09:00
commit f7142828ac
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
6 changed files with 14 additions and 17 deletions

View file

@ -22,7 +22,7 @@ pub struct ServerCrypto {
// For Quic/HTTP3, only servers with no client authentication
#[cfg(feature = "http3-quinn")]
pub inner_global_no_client_auth: Arc<ServerConfig>,
#[cfg(feature = "http3-s2n")]
#[cfg(all(feature = "http3-s2n", not(feature = "http3-quinn")))]
pub inner_global_no_client_auth: s2n_quic_rustls::Server,
// For TLS over TCP/HTTP2 and 1.1, map of SNI to server_crypto for all given servers
pub inner_local_map: Arc<SniServerCryptoMap>,
@ -74,7 +74,7 @@ impl TryInto<Arc<ServerCrypto>> for &ServerCryptoBase {
Ok(Arc::new(ServerCrypto {
#[cfg(feature = "http3-quinn")]
inner_global_no_client_auth: Arc::new(server_crypto_global),
#[cfg(feature = "http3-s2n")]
#[cfg(all(feature = "http3-s2n", not(feature = "http3-quinn")))]
inner_global_no_client_auth: server_crypto_global,
inner_local_map: Arc::new(server_crypto_local_map),
}))
@ -200,7 +200,7 @@ impl ServerCryptoBase {
Ok(server_crypto_global)
}
#[cfg(feature = "http3-s2n")]
#[cfg(all(feature = "http3-s2n", not(feature = "http3-quinn")))]
fn build_server_crypto_global(&self) -> Result<s2n_quic_rustls::Server, ReloaderError<ServerCryptoBase>> {
let mut resolver_global = s2n_quic_rustls::rustls::server::ResolvesServerCertUsingSni::new();
@ -241,7 +241,7 @@ impl ServerCryptoBase {
}
}
#[cfg(feature = "http3-s2n")]
#[cfg(all(feature = "http3-s2n", not(feature = "http3-quinn")))]
/// This is workaround for the version difference between rustls and s2n-quic-rustls
fn parse_server_certs_and_keys_s2n(
certs_and_keys: &CertsAndKeys,