Skip to content

Commit

Permalink
improve error message if incompabitle Identity with selected backend (#…
Browse files Browse the repository at this point in the history
…1852)

If ClientBuilder::build encounters a TlsBackend::Default, and
cfg(native-tls) is not enabled, it doesn't know how to load the client
certificate. Rather than silently ignore the attempt to use a client
identity, return an error.

* ClientBuilder: fix build when rustls and native-tls are both enabled
  • Loading branch information
eric-seppanen authored Aug 21, 2023
1 parent 42f57b4 commit 87ff5d9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/async_impl/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,13 @@ impl ClientBuilder {
id.add_to_native_tls(&mut tls)?;
}
}
#[cfg(all(feature = "__rustls", not(feature = "native-tls")))]
{
// Default backend + rustls Identity doesn't work.
if let Some(_id) = config.identity {
return Err(crate::error::builder("incompatible TLS identity type"));
}
}

if let Some(min_tls_version) = config.min_tls_version {
let protocol = min_tls_version.to_native_tls().ok_or_else(|| {
Expand Down

0 comments on commit 87ff5d9

Please sign in to comment.