From f5f6132f948ec8d30251cfc13523db1827f25e2e Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 4 Feb 2024 03:30:16 +0000 Subject: [PATCH] test: update rustls for test_server --- actix-web/Cargo.toml | 6 +++--- actix-web/tests/test_server.rs | 19 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/actix-web/Cargo.toml b/actix-web/Cargo.toml index 8c1cc9bf..aedcb3ef 100644 --- a/actix-web/Cargo.toml +++ b/actix-web/Cargo.toml @@ -128,12 +128,12 @@ env_logger = "0.10" flate2 = "1.0.13" futures-util = { version = "0.3.17", default-features = false, features = ["std"] } rand = "0.8" -rcgen = "0.11" -rustls-pemfile = "1" +rcgen = "0.12" +rustls-pemfile = "2" serde = { version = "1.0", features = ["derive"] } static_assertions = "1" tls-openssl = { package = "openssl", version = "0.10.55" } -tls-rustls = { package = "rustls", version = "0.21" } +tls-rustls = { package = "rustls", version = "0.22" } tokio = { version = "1.24.2", features = ["rt-multi-thread", "macros"] } zstd = "0.13" diff --git a/actix-web/tests/test_server.rs b/actix-web/tests/test_server.rs index 0df6e212..36f45c14 100644 --- a/actix-web/tests/test_server.rs +++ b/actix-web/tests/test_server.rs @@ -1,6 +1,6 @@ #[cfg(feature = "openssl")] extern crate tls_openssl as openssl; -#[cfg(feature = "rustls-0_21")] +#[cfg(feature = "rustls-0_22")] extern crate tls_rustls as rustls; use std::{ @@ -708,7 +708,7 @@ async fn test_brotli_encoding_large_openssl() { mod plus_rustls { use std::io::BufReader; - use rustls::{Certificate, PrivateKey, ServerConfig as RustlsServerConfig}; + use rustls::{pki_types::PrivateKeyDer, ServerConfig as RustlsServerConfig}; use rustls_pemfile::{certs, pkcs8_private_keys}; use super::*; @@ -721,17 +721,14 @@ mod plus_rustls { let cert_file = &mut BufReader::new(cert_file.as_bytes()); let key_file = &mut BufReader::new(key_file.as_bytes()); - let cert_chain = certs(cert_file) - .unwrap() - .into_iter() - .map(Certificate) - .collect(); - let mut keys = pkcs8_private_keys(key_file).unwrap(); + let cert_chain = certs(cert_file).collect::, _>>().unwrap(); + let mut keys = pkcs8_private_keys(key_file) + .collect::, _>>() + .unwrap(); RustlsServerConfig::builder() - .with_safe_defaults() .with_no_client_auth() - .with_single_cert(cert_chain, PrivateKey(keys.remove(0))) + .with_single_cert(cert_chain, PrivateKeyDer::Pkcs8(keys.remove(0))) .unwrap() } @@ -743,7 +740,7 @@ mod plus_rustls { .map(char::from) .collect::(); - let srv = actix_test::start_with(actix_test::config().rustls_0_21(tls_config()), || { + let srv = actix_test::start_with(actix_test::config().rustls_0_22(tls_config()), || { App::new().service(web::resource("/").route(web::to(|bytes: Bytes| async { // echo decompressed request body back in response HttpResponse::Ok()