From 12785710e9ec28ed36c4b083996c1364915dfc7f Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 27 Jun 2022 03:09:49 +0100 Subject: [PATCH] fix tests --- actix-http/src/service.rs | 2 +- actix-http/tests/test_openssl.rs | 5 ++--- actix-http/tests/test_rustls.rs | 8 ++++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/actix-http/src/service.rs b/actix-http/src/service.rs index 469a95ba0..27029cb8e 100644 --- a/actix-http/src/service.rs +++ b/actix-http/src/service.rs @@ -195,7 +195,7 @@ impl TlsAcceptorConfig { pub fn handshake_timeout(self, dur: std::time::Duration) -> Self { Self { handshake_timeout: Some(dur), - ..self + // ..self } } } diff --git a/actix-http/tests/test_openssl.rs b/actix-http/tests/test_openssl.rs index d0bb73f68..b97b2e45b 100644 --- a/actix-http/tests/test_openssl.rs +++ b/actix-http/tests/test_openssl.rs @@ -2,8 +2,7 @@ extern crate tls_openssl as openssl; -use std::time::Duration; -use std::{convert::Infallible, io}; +use std::{convert::Infallible, io, time::Duration}; use actix_http::{ body::{BodyStream, BoxBody, SizedStream}, @@ -92,7 +91,7 @@ async fn h2_1() -> io::Result<()> { }) .openssl_with_config( tls_config(), - TlsAcceptorConfig::new(Some(Duration::from_secs(5))), + TlsAcceptorConfig::default().handshake_timeout(Duration::from_secs(5)), ) .map_err(|_| ()) }) diff --git a/actix-http/tests/test_rustls.rs b/actix-http/tests/test_rustls.rs index 550375296..2bbf1524b 100644 --- a/actix-http/tests/test_rustls.rs +++ b/actix-http/tests/test_rustls.rs @@ -8,13 +8,14 @@ use std::{ net::{SocketAddr, TcpStream as StdTcpStream}, sync::Arc, task::Poll, + time::Duration, }; use actix_http::{ body::{BodyStream, BoxBody, SizedStream}, error::PayloadError, header::{self, HeaderName, HeaderValue}, - Error, HttpService, Method, Request, Response, StatusCode, Version, + Error, HttpService, Method, Request, Response, StatusCode, TlsAcceptorConfig, Version, }; use actix_http_test::test_server; use actix_rt::pin; @@ -160,7 +161,10 @@ async fn h2_1() -> io::Result<()> { assert_eq!(req.version(), Version::HTTP_2); ok::<_, Error>(Response::ok()) }) - .rustls(tls_config()) + .rustls_with_config( + tls_config(), + TlsAcceptorConfig::default().handshake_timeout(Duration::from_secs(5)), + ) }) .await;