mirror of https://github.com/fafhrd91/actix-web
bump to actix-server 2.0.0-beta.7
This commit is contained in:
parent
5e554dca35
commit
811bc957ef
|
@ -1,6 +1,7 @@
|
||||||
[alias]
|
[alias]
|
||||||
chk = "check --workspace --all-features --tests --examples --bins"
|
lint = "clippy --workspace --tests --examples --bins -- -Dclippy::todo"
|
||||||
lint = "clippy --workspace --all-features --tests --examples --bins"
|
lint-all = "clippy --workspace --all-features --tests --examples --bins -- -Dclippy::todo"
|
||||||
|
|
||||||
ci-min = "hack check --workspace --no-default-features"
|
ci-min = "hack check --workspace --no-default-features"
|
||||||
ci-min-test = "hack check --workspace --no-default-features --tests --examples"
|
ci-min-test = "hack check --workspace --no-default-features --tests --examples"
|
||||||
ci-default = "check --workspace --bins --tests --examples"
|
ci-default = "check --workspace --bins --tests --examples"
|
||||||
|
|
|
@ -68,8 +68,8 @@ __compress = []
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-codec = "0.4.0"
|
actix-codec = "0.4.0"
|
||||||
actix-macros = "0.2.3"
|
actix-macros = "0.2.3"
|
||||||
actix-rt = "2.2"
|
actix-rt = "2.4"
|
||||||
actix-server = "2.0.0-beta.3"
|
actix-server = "2.0.0-beta.7"
|
||||||
actix-service = "2.0.0"
|
actix-service = "2.0.0"
|
||||||
actix-utils = "3.0.0"
|
actix-utils = "3.0.0"
|
||||||
actix-tls = { version = "3.0.0-beta.7", default-features = false, optional = true }
|
actix-tls = { version = "3.0.0-beta.7", default-features = false, optional = true }
|
||||||
|
@ -117,6 +117,7 @@ rcgen = "0.8"
|
||||||
rustls-pemfile = "0.2"
|
rustls-pemfile = "0.2"
|
||||||
tls-openssl = { package = "openssl", version = "0.10.9" }
|
tls-openssl = { package = "openssl", version = "0.10.9" }
|
||||||
tls-rustls = { package = "rustls", version = "0.20.0" }
|
tls-rustls = { package = "rustls", version = "0.20.0" }
|
||||||
|
tokio = { version = "1.5.1", features = ["rt-multi-thread", "macros"] }
|
||||||
zstd = "0.7"
|
zstd = "0.7"
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|
|
@ -34,7 +34,7 @@ actix-codec = "0.4.0"
|
||||||
actix-tls = "3.0.0-beta.7"
|
actix-tls = "3.0.0-beta.7"
|
||||||
actix-utils = "3.0.0"
|
actix-utils = "3.0.0"
|
||||||
actix-rt = "2.2"
|
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 }
|
awc = { version = "3.0.0-beta.9", default-features = false }
|
||||||
|
|
||||||
base64 = "0.13"
|
base64 = "0.13"
|
||||||
|
|
|
@ -73,9 +73,12 @@ pub async fn test_server_with_addr<F: ServiceFactory<TcpStream>>(
|
||||||
.disable_signals();
|
.disable_signals();
|
||||||
|
|
||||||
sys.block_on(async {
|
sys.block_on(async {
|
||||||
srv.run();
|
let srv = srv.run();
|
||||||
tx.send((System::current(), local_addr)).unwrap();
|
tx.send((System::current(), local_addr)).unwrap();
|
||||||
});
|
|
||||||
|
srv.await
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
sys.run()
|
sys.run()
|
||||||
});
|
});
|
||||||
|
|
|
@ -82,7 +82,7 @@ flate2 = { version = "1.0.13", optional = true }
|
||||||
zstd = { version = "0.7", optional = true }
|
zstd = { version = "0.7", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[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-http-test = { version = "3.0.0-beta.5", features = ["openssl"] }
|
||||||
actix-tls = { version = "3.0.0-beta.7", features = ["openssl"] }
|
actix-tls = { version = "3.0.0-beta.7", features = ["openssl"] }
|
||||||
async-stream = "0.3"
|
async-stream = "0.3"
|
||||||
|
|
|
@ -26,10 +26,7 @@ use bytes::{Bytes, BytesMut};
|
||||||
use derive_more::{Display, Error};
|
use derive_more::{Display, Error};
|
||||||
use futures_core::Stream;
|
use futures_core::Stream;
|
||||||
use futures_util::stream::{once, StreamExt as _};
|
use futures_util::stream::{once, StreamExt as _};
|
||||||
use rustls::{
|
use rustls::{Certificate, PrivateKey, ServerConfig as RustlsServerConfig, ServerName};
|
||||||
Certificate, OwnedTrustAnchor, PrivateKey, RootCertStore,
|
|
||||||
ServerConfig as RustlsServerConfig, ServerName,
|
|
||||||
};
|
|
||||||
use rustls_pemfile::{certs, pkcs8_private_keys};
|
use rustls_pemfile::{certs, pkcs8_private_keys};
|
||||||
|
|
||||||
async fn load_body<S>(mut stream: S) -> Result<BytesMut, PayloadError>
|
async fn load_body<S>(mut stream: S) -> Result<BytesMut, PayloadError>
|
||||||
|
@ -81,21 +78,21 @@ pub fn get_negotiated_alpn_protocol(
|
||||||
|
|
||||||
config.alpn_protocols.push(client_alpn_protocol.to_vec());
|
config.alpn_protocols.push(client_alpn_protocol.to_vec());
|
||||||
|
|
||||||
let mut sess = rustls::ClientConnection::new(
|
let mut session = rustls::ClientConnection::new(
|
||||||
Arc::new(config),
|
Arc::new(config),
|
||||||
ServerName::try_from("localhost").unwrap(),
|
ServerName::try_from("localhost").unwrap(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut sock = StdTcpStream::connect(addr).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
|
// 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
|
// certificate, but it doesn't matter here as we are just interested in the negotiated
|
||||||
// protocol
|
// ALPN protocol
|
||||||
let _ = stream.flush();
|
let _ = stream.flush();
|
||||||
|
|
||||||
sess.alpn_protocol().map(|proto| proto.to_vec())
|
session.alpn_protocol().map(|proto| proto.to_vec())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
|
|
|
@ -506,7 +506,7 @@ impl TestServer {
|
||||||
|
|
||||||
/// Gracefully stop HTTP server.
|
/// Gracefully stop HTTP server.
|
||||||
pub async fn stop(self) {
|
pub async fn stop(self) {
|
||||||
self.server.stop(true).await;
|
self.server.handle().stop(true).await;
|
||||||
self.system.stop();
|
self.system.stop();
|
||||||
rt::time::sleep(time::Duration::from_millis(100)).await;
|
rt::time::sleep(time::Duration::from_millis(100)).await;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = { version = "3.0.0-beta.11", features = ["openssl"] }
|
||||||
actix-http-test = { version = "3.0.0-beta.5", features = ["openssl"] }
|
actix-http-test = { version = "3.0.0-beta.5", features = ["openssl"] }
|
||||||
actix-utils = "3.0.0"
|
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-tls = { version = "3.0.0-beta.7", features = ["openssl", "rustls"] }
|
||||||
actix-test = { version = "0.1.0-beta.5", features = ["openssl", "rustls"] }
|
actix-test = { version = "0.1.0-beta.5", features = ["openssl", "rustls"] }
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,7 @@ use actix_utils::future::ok;
|
||||||
use actix_web::{dev::AppConfig, http::Version, web, App, HttpResponse};
|
use actix_web::{dev::AppConfig, http::Version, web, App, HttpResponse};
|
||||||
use rustls::{
|
use rustls::{
|
||||||
client::{ServerCertVerified, ServerCertVerifier},
|
client::{ServerCertVerified, ServerCertVerifier},
|
||||||
Certificate, ClientConfig, OwnedTrustAnchor, PrivateKey, RootCertStore, ServerConfig,
|
Certificate, ClientConfig, PrivateKey, ServerConfig, ServerName,
|
||||||
ServerName,
|
|
||||||
};
|
};
|
||||||
use rustls_pemfile::{certs, pkcs8_private_keys};
|
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_root_certificates(webpki_roots_cert_store())
|
||||||
.with_no_client_auth();
|
.with_no_client_auth();
|
||||||
|
|
||||||
let protos = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
|
let protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
|
||||||
config.alpn_protocols = protos;
|
config.alpn_protocols = protocols;
|
||||||
|
|
||||||
// disable TLS verification
|
// disable TLS verification
|
||||||
config
|
config
|
||||||
|
|
|
@ -16,7 +16,7 @@ async fn no_params() -> &'static str {
|
||||||
"Hello world!\r\n"
|
"Hello world!\r\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web::main]
|
#[tokio::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ where
|
||||||
///
|
///
|
||||||
/// By default max connections is set to a 25k.
|
/// By default max connections is set to a 25k.
|
||||||
pub fn max_connections(mut self, num: usize) -> Self {
|
pub fn max_connections(mut self, num: usize) -> Self {
|
||||||
self.builder = self.builder.maxconn(num);
|
self.builder = self.builder.max_concurrent_connections(num);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ async fn test_start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop
|
// stop
|
||||||
let _ = srv.stop(false);
|
let _ = srv.handle().stop(false);
|
||||||
|
|
||||||
thread::sleep(Duration::from_millis(100));
|
thread::sleep(Duration::from_millis(100));
|
||||||
let _ = sys.stop();
|
let _ = sys.stop();
|
||||||
|
@ -88,8 +88,8 @@ fn ssl_acceptor() -> openssl::ssl::SslAcceptorBuilder {
|
||||||
builder
|
builder
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
|
||||||
#[cfg(feature = "openssl")]
|
#[cfg(feature = "openssl")]
|
||||||
|
#[actix_rt::test]
|
||||||
async fn test_start_ssl() {
|
async fn test_start_ssl() {
|
||||||
use actix_web::HttpRequest;
|
use actix_web::HttpRequest;
|
||||||
|
|
||||||
|
@ -142,7 +142,8 @@ async fn test_start_ssl() {
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// stop
|
// stop
|
||||||
let _ = srv.stop(false);
|
let _ = srv.handle().stop(false);
|
||||||
|
let _ = srv.await;
|
||||||
|
|
||||||
thread::sleep(Duration::from_millis(100));
|
thread::sleep(Duration::from_millis(100));
|
||||||
let _ = sys.stop();
|
let _ = sys.stop();
|
||||||
|
|
Loading…
Reference in New Issue