Skip to content

Commit

Permalink
test: update rustls for test_server
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Feb 4, 2024
1 parent d9b31b8 commit f5f6132
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
6 changes: 3 additions & 3 deletions actix-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
19 changes: 8 additions & 11 deletions actix-web/tests/test_server.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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::*;
Expand All @@ -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::<Result<Vec<_>, _>>().unwrap();
let mut keys = pkcs8_private_keys(key_file)
.collect::<Result<Vec<_>, _>>()
.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()
}

Expand All @@ -743,7 +740,7 @@ mod plus_rustls {
.map(char::from)
.collect::<String>();

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()), || {

Check failure on line 743 in actix-web/tests/test_server.rs

View workflow job for this annotation

GitHub Actions / Linux / msrv

no method named `rustls_0_22` found for struct `TestServerConfig` in the current scope

Check failure on line 743 in actix-web/tests/test_server.rs

View workflow job for this annotation

GitHub Actions / Linux / stable

no method named `rustls_0_22` found for struct `TestServerConfig` in the current scope

Check failure on line 743 in actix-web/tests/test_server.rs

View workflow job for this annotation

GitHub Actions / macOS / msrv

no method named `rustls_0_22` found for struct `TestServerConfig` in the current scope

Check failure on line 743 in actix-web/tests/test_server.rs

View workflow job for this annotation

GitHub Actions / macOS / stable

no method named `rustls_0_22` found for struct `TestServerConfig` in the current scope

Check failure on line 743 in actix-web/tests/test_server.rs

View workflow job for this annotation

GitHub Actions / Windows / msrv

no method named `rustls_0_22` found for struct `TestServerConfig` in the current scope

Check failure on line 743 in actix-web/tests/test_server.rs

View workflow job for this annotation

GitHub Actions / Windows / stable

no method named `rustls_0_22` found for struct `TestServerConfig` in the current scope

Check failure on line 743 in actix-web/tests/test_server.rs

View workflow job for this annotation

GitHub Actions / Linux / nightly

no method named `rustls_0_22` found for struct `TestServerConfig` in the current scope

Check failure on line 743 in actix-web/tests/test_server.rs

View workflow job for this annotation

GitHub Actions / macOS / nightly

no method named `rustls_0_22` found for struct `TestServerConfig` in the current scope

Check failure on line 743 in actix-web/tests/test_server.rs

View workflow job for this annotation

GitHub Actions / Windows / nightly

no method named `rustls_0_22` found for struct `TestServerConfig` in the current scope
App::new().service(web::resource("/").route(web::to(|bytes: Bytes| async {
// echo decompressed request body back in response
HttpResponse::Ok()
Expand Down

0 comments on commit f5f6132

Please sign in to comment.