Skip to content

Commit 04bf45f

Browse files
authored
fix: tls version limit for rustls (#2203)
1 parent 056f8c4 commit 04bf45f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/async_impl/client.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,14 @@ impl ClientBuilder {
551551
});
552552
}
553553

554+
if versions.is_empty() {
555+
return Err(crate::error::builder("empty supported tls versions"));
556+
}
557+
554558
// Build TLS config
555559
let config_builder =
556-
rustls::ClientConfig::builder().with_root_certificates(root_cert_store);
560+
rustls::ClientConfig::builder_with_protocol_versions(&versions)
561+
.with_root_certificates(root_cert_store);
557562

558563
// Finalize TLS config
559564
let mut tls = if let Some(id) = config.identity {
@@ -1475,6 +1480,9 @@ impl ClientBuilder {
14751480
/// isn't supported, just that it can't be set as a maximum due to
14761481
/// technical limitations.
14771482
///
1483+
/// Cannot set a maximum outside the protocol versions supported by
1484+
/// `rustls` with the `rustls-tls` backend.
1485+
///
14781486
/// # Optional
14791487
///
14801488
/// This requires the optional `default-tls`, `native-tls`, or `rustls-tls(-...)`

0 commit comments

Comments
 (0)