From 2b490280d852445aef02f415f6e1d5ebb804facb Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Sat, 2 Dec 2023 11:15:36 -0800 Subject: [PATCH] Cargo: update dependencies Bump dependencies from alphas to released versions, fix examples to accommodate breaking changes. --- Cargo.lock | 20 ++++++++++---------- Cargo.toml | 10 +++++----- examples/google.rs | 1 - src/lib.rs | 12 ++++++------ tests/smoketests.rs | 1 - 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12f8172..06e5295 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -467,9 +467,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.0-alpha.6" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d42991943cf48034955ba6d9a28f30e6b1e5fd73e46737ce52e8461bcc28e3" +checksum = "5bc238b76c51bbc449c55ffbc39d03772a057cc8cf783c49d4af4c2537b74a8b" dependencies = [ "log", "ring 0.17.6", @@ -499,9 +499,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.0.0-alpha.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9975e1f0807681e097d288d545dc40c98a4d3a6ef95a40b18d00e5e4daa9a4" +checksum = "35e4980fa29e4c4b212ffb3db068a564cbf560e51d3944b7c88bd8bf5bec64f4" dependencies = [ "base64", "rustls-pki-types", @@ -509,15 +509,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "0.2.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d3edd6cdcdf26eda538757038343986e666d0b8ba4b5ac1de663b78475550d" +checksum = "eb0a1f9b9efec70d32e6d6aa3e58ebd88c3754ec98dfe9145c63cf54cc829b83" [[package]] name = "rustls-webpki" -version = "0.102.0-alpha.8" +version = "0.102.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139cdfd1d8b96f927fbe0a0c98785afe94b63e95a7ef815ebae9263d20e10a0d" +checksum = "de2635c8bc2b88d367767c5de8ea1d8db9af3f6219eba28442242d9ab81d1b89" dependencies = [ "ring 0.17.6", "rustls-pki-types", @@ -819,9 +819,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.0-alpha.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e3d99d80231fabcc72d887ed09f843b7f3942c75907285e51112a46c8f6f81" +checksum = "0de2cfda980f21be5a7ed2eadb3e6fe074d56022bea2cdeb1a62eb220fc04188" dependencies = [ "rustls-pki-types", ] diff --git a/Cargo.toml b/Cargo.toml index 62c4b20..0568bcf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,16 +11,16 @@ repository = "https://github.com/rustls/rustls-native-certs" categories = ["network-programming", "cryptography"] [dependencies] -rustls-pemfile = "=2.0.0-alpha.2" -pki-types = { package = "rustls-pki-types", version = "0.2.2" } +rustls-pemfile = "2" +pki-types = { package = "rustls-pki-types", version = "1" } [dev-dependencies] ring = "0.16.5" -rustls = "=0.22.0-alpha.6" -rustls-webpki = "=0.102.0-alpha.8" +rustls = "0.22" +rustls-webpki = "0.102" serial_test = "2" untrusted = "0.7" # stick to the version ring depends on for now -webpki-roots = "=0.26.0-alpha.2" +webpki-roots = "0.26" x509-parser = "0.15" [target.'cfg(windows)'.dependencies] diff --git a/examples/google.rs b/examples/google.rs index 5387e6f..5b7baac 100644 --- a/examples/google.rs +++ b/examples/google.rs @@ -9,7 +9,6 @@ fn main() { } let config = rustls::ClientConfig::builder() - .with_safe_defaults() .with_root_certificates(roots) .with_no_client_auth(); diff --git a/src/lib.rs b/src/lib.rs index e935329..8c2b884 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,14 +71,14 @@ fn load_certs_from_env() -> Option>, Error>> } fn load_pem_certs(path: &Path) -> Result>, Error> { - let f = File::open(path)?; - let mut f = BufReader::new(f); + let mut f = BufReader::new(File::open(path)?); rustls_pemfile::certs(&mut f) - .collect::, _>>() - .map_err(|err| { - Error::new( + .map(|result| match result { + Ok(der) => Ok(der), + Err(err) => Err(Error::new( ErrorKind::InvalidData, format!("could not load PEM file {path:?}: {err}"), - ) + )), }) + .collect() } diff --git a/tests/smoketests.rs b/tests/smoketests.rs index 693b6e4..7e7fe3c 100644 --- a/tests/smoketests.rs +++ b/tests/smoketests.rs @@ -15,7 +15,6 @@ fn check_site(domain: &str) { } let config = rustls::ClientConfig::builder() - .with_safe_defaults() .with_root_certificates(roots) .with_no_client_auth();