Skip to content

Commit 8fe383b

Browse files
authored
Merge pull request #95 from benashford/upgrade_rustls
Upgrade Rustls
2 parents a970373 + 80047cc commit 8fe383b

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "redis-async"
3-
version = "0.17.1"
3+
version = "0.17.2"
44
authors = ["Ben Ashford <benashford@users.noreply.github.com>"]
55
license = "MIT/Apache-2.0"
66
readme = "README.md"
@@ -20,9 +20,9 @@ pin-project = "1.0"
2020
socket2 = { version = "0.5", features = ["all"] }
2121
tokio = { version = "1.0", features = ["rt", "net", "time"] }
2222
tokio-native-tls = { version = "0.3.0", optional = true }
23-
tokio-rustls = { version = "0.24", optional = true }
23+
tokio-rustls = { version = "0.26", optional = true }
2424
tokio-util = { version = "0.7", features = ["codec"] }
25-
webpki-roots = { version = "0.23", optional = true }
25+
webpki-roots = { version = "0.26", optional = true }
2626

2727
[features]
2828
default = []

src/client/connect.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -132,20 +132,13 @@ pub async fn connect_tls(
132132
) -> Result<RespConnection, error::Error> {
133133
use std::sync::Arc;
134134
use tokio_rustls::{
135-
rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore},
135+
rustls::{ClientConfig, RootCertStore},
136136
TlsConnector,
137137
};
138138

139139
let mut root_store = RootCertStore::empty();
140-
root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| {
141-
OwnedTrustAnchor::from_subject_spki_name_constraints(
142-
ta.subject,
143-
ta.spki,
144-
ta.name_constraints,
145-
)
146-
}));
140+
root_store.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
147141
let config = ClientConfig::builder()
148-
.with_safe_defaults()
149142
.with_root_certificates(root_store)
150143
.with_no_client_auth();
151144
let connector = TlsConnector::from(Arc::new(config));
@@ -161,7 +154,8 @@ pub async fn connect_tls(
161154

162155
let stream = connector
163156
.connect(
164-
host.try_into()
157+
String::from(host)
158+
.try_into()
165159
.map_err(|_err| error::Error::InvalidDnsName)?,
166160
tcp_stream,
167161
)

0 commit comments

Comments
 (0)