diff --git a/.cargo/config.toml b/.cargo/config.toml index 40a513efd..5012ac8cb 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,6 +1,7 @@ [alias] -chk = "check --workspace --all-features --tests --examples --bins" -lint = "clippy --workspace --all-features --tests --examples --bins" +lint = "clippy --workspace --tests --examples --bins -- -Dclippy::todo" +lint-all = "clippy --workspace --all-features --tests --examples --bins -- -Dclippy::todo" + ci-min = "hack check --workspace --no-default-features" ci-min-test = "hack check --workspace --no-default-features --tests --examples" ci-default = "check --workspace --bins --tests --examples" diff --git a/Cargo.toml b/Cargo.toml index 152282207..f0dc520f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,8 +68,8 @@ __compress = [] [dependencies] actix-codec = "0.4.0" actix-macros = "0.2.3" -actix-rt = "2.2" -actix-server = "2.0.0-beta.3" +actix-rt = "2.4" +actix-server = "2.0.0-beta.7" actix-service = "2.0.0" actix-utils = "3.0.0" actix-tls = { version = "3.0.0-beta.7", default-features = false, optional = true } @@ -117,6 +117,7 @@ rcgen = "0.8" rustls-pemfile = "0.2" tls-openssl = { package = "openssl", version = "0.10.9" } tls-rustls = { package = "rustls", version = "0.20.0" } +tokio = { version = "1.5.1", features = ["rt-multi-thread", "macros"] } zstd = "0.7" [profile.dev] diff --git a/actix-http-test/Cargo.toml b/actix-http-test/Cargo.toml index d3fc8a47f..7c94b12aa 100644 --- a/actix-http-test/Cargo.toml +++ b/actix-http-test/Cargo.toml @@ -34,7 +34,7 @@ actix-codec = "0.4.0" actix-tls = "3.0.0-beta.7" actix-utils = "3.0.0" actix-rt = "2.2" -actix-server = "2.0.0-beta.3" +actix-server = "2.0.0-beta.7" awc = { version = "3.0.0-beta.9", default-features = false } base64 = "0.13" diff --git a/actix-http-test/src/lib.rs b/actix-http-test/src/lib.rs index c7b083b5e..c2534eb7c 100644 --- a/actix-http-test/src/lib.rs +++ b/actix-http-test/src/lib.rs @@ -73,9 +73,12 @@ pub async fn test_server_with_addr>( .disable_signals(); sys.block_on(async { - srv.run(); + let srv = srv.run(); tx.send((System::current(), local_addr)).unwrap(); - }); + + srv.await + }) + .unwrap(); sys.run() }); diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index 7d39e000a..04b876c2a 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -82,7 +82,7 @@ flate2 = { version = "1.0.13", optional = true } zstd = { version = "0.7", optional = true } [dev-dependencies] -actix-server = "2.0.0-beta.3" +actix-server = "2.0.0-beta.7" actix-http-test = { version = "3.0.0-beta.5", features = ["openssl"] } actix-tls = { version = "3.0.0-beta.7", features = ["openssl"] } async-stream = "0.3" diff --git a/actix-http/tests/test_rustls.rs b/actix-http/tests/test_rustls.rs index 924ef49ad..f05526402 100644 --- a/actix-http/tests/test_rustls.rs +++ b/actix-http/tests/test_rustls.rs @@ -26,10 +26,7 @@ use bytes::{Bytes, BytesMut}; use derive_more::{Display, Error}; use futures_core::Stream; use futures_util::stream::{once, StreamExt as _}; -use rustls::{ - Certificate, OwnedTrustAnchor, PrivateKey, RootCertStore, - ServerConfig as RustlsServerConfig, ServerName, -}; +use rustls::{Certificate, PrivateKey, ServerConfig as RustlsServerConfig, ServerName}; use rustls_pemfile::{certs, pkcs8_private_keys}; async fn load_body(mut stream: S) -> Result @@ -81,21 +78,21 @@ pub fn get_negotiated_alpn_protocol( config.alpn_protocols.push(client_alpn_protocol.to_vec()); - let mut sess = rustls::ClientConnection::new( + let mut session = rustls::ClientConnection::new( Arc::new(config), ServerName::try_from("localhost").unwrap(), ) .unwrap(); let mut sock = StdTcpStream::connect(addr).unwrap(); - let mut stream = rustls::Stream::new(&mut sess, &mut sock); + let mut stream = rustls::Stream::new(&mut session, &mut sock); // The handshake will fails because the client will not be able to verify the server - // certificate, but it doesn't matter here as we are just interested in the negotiated ALPN - // protocol + // certificate, but it doesn't matter here as we are just interested in the negotiated + // ALPN protocol let _ = stream.flush(); - sess.alpn_protocol().map(|proto| proto.to_vec()) + session.alpn_protocol().map(|proto| proto.to_vec()) } #[actix_rt::test] diff --git a/actix-test/src/lib.rs b/actix-test/src/lib.rs index 23a7eeba1..9c5db42ba 100644 --- a/actix-test/src/lib.rs +++ b/actix-test/src/lib.rs @@ -506,7 +506,7 @@ impl TestServer { /// Gracefully stop HTTP server. pub async fn stop(self) { - self.server.stop(true).await; + self.server.handle().stop(true).await; self.system.stop(); rt::time::sleep(time::Duration::from_millis(100)).await; } diff --git a/awc/Cargo.toml b/awc/Cargo.toml index 6eeb9ce51..b86e0ab12 100644 --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -92,7 +92,7 @@ actix-web = { version = "4.0.0-beta.10", features = ["openssl"] } actix-http = { version = "3.0.0-beta.11", features = ["openssl"] } actix-http-test = { version = "3.0.0-beta.5", features = ["openssl"] } actix-utils = "3.0.0" -actix-server = "2.0.0-beta.3" +actix-server = "2.0.0-beta.7" actix-tls = { version = "3.0.0-beta.7", features = ["openssl", "rustls"] } actix-test = { version = "0.1.0-beta.5", features = ["openssl", "rustls"] } diff --git a/awc/tests/test_rustls_client.rs b/awc/tests/test_rustls_client.rs index c075a6090..aeb242364 100644 --- a/awc/tests/test_rustls_client.rs +++ b/awc/tests/test_rustls_client.rs @@ -19,8 +19,7 @@ use actix_utils::future::ok; use actix_web::{dev::AppConfig, http::Version, web, App, HttpResponse}; use rustls::{ client::{ServerCertVerified, ServerCertVerifier}, - Certificate, ClientConfig, OwnedTrustAnchor, PrivateKey, RootCertStore, ServerConfig, - ServerName, + Certificate, ClientConfig, PrivateKey, ServerConfig, ServerName, }; use rustls_pemfile::{certs, pkcs8_private_keys}; @@ -94,8 +93,8 @@ async fn test_connection_reuse_h2() { .with_root_certificates(webpki_roots_cert_store()) .with_no_client_auth(); - let protos = vec![b"h2".to_vec(), b"http/1.1".to_vec()]; - config.alpn_protocols = protos; + let protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()]; + config.alpn_protocols = protocols; // disable TLS verification config diff --git a/examples/basic.rs b/examples/basic.rs index d29546129..8f288e0a4 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -16,7 +16,7 @@ async fn no_params() -> &'static str { "Hello world!\r\n" } -#[actix_web::main] +#[tokio::main] async fn main() -> std::io::Result<()> { env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); diff --git a/src/server.rs b/src/server.rs index f15183f85..d69b1ef51 100644 --- a/src/server.rs +++ b/src/server.rs @@ -159,7 +159,7 @@ where /// /// By default max connections is set to a 25k. pub fn max_connections(mut self, num: usize) -> Self { - self.builder = self.builder.maxconn(num); + self.builder = self.builder.max_concurrent_connections(num); self } diff --git a/tests/test_httpserver.rs b/tests/test_httpserver.rs index 881c6ce94..48fcec4a6 100644 --- a/tests/test_httpserver.rs +++ b/tests/test_httpserver.rs @@ -61,7 +61,7 @@ async fn test_start() { } // stop - let _ = srv.stop(false); + let _ = srv.handle().stop(false); thread::sleep(Duration::from_millis(100)); let _ = sys.stop(); @@ -88,8 +88,8 @@ fn ssl_acceptor() -> openssl::ssl::SslAcceptorBuilder { builder } -#[actix_rt::test] #[cfg(feature = "openssl")] +#[actix_rt::test] async fn test_start_ssl() { use actix_web::HttpRequest; @@ -142,7 +142,8 @@ async fn test_start_ssl() { assert!(response.status().is_success()); // stop - let _ = srv.stop(false); + let _ = srv.handle().stop(false); + let _ = srv.await; thread::sleep(Duration::from_millis(100)); let _ = sys.stop();