1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

add rustls support for actix-http and awc (#998)

* add rustls support for actix-http and awc

* fix features conflict

* remove unnecessary duplication

* test server with rust-tls

* fix

* test rustls

* awc rustls test

* format

* tests

* fix dependencies

* fixes and add changes

* remove test-server and Cargo.toml dev-dependencies changes

* cargo fmt
This commit is contained in:
Marat Safin
2019-07-31 23:02:56 +03:00
committed by Nikolay Kim
parent 0d9ea41047
commit cb19ebfe0c
21 changed files with 1317 additions and 674 deletions

View File

@ -36,6 +36,7 @@ actix-service = "0.4.1"
actix-server = "0.6.0"
actix-utils = "0.4.1"
awc = "0.2.2"
actix-connect = "0.2.2"
base64 = "0.10"
bytes = "0.4"

View File

@ -163,6 +163,10 @@ impl TestServer {
Ok::<Client, ()>(Client::build().connector(connector).finish())
}))
.unwrap();
rt.block_on(lazy(
|| Ok::<_, ()>(actix_connect::start_default_resolver()),
))
.unwrap();
System::set_current(system);
TestServerRuntime { addr, rt, client }
}
@ -212,18 +216,18 @@ impl TestServerRuntime {
/// Construct test server url
pub fn url(&self, uri: &str) -> String {
if uri.starts_with('/') {
format!("http://127.0.0.1:{}{}", self.addr.port(), uri)
format!("http://localhost:{}{}", self.addr.port(), uri)
} else {
format!("http://127.0.0.1:{}/{}", self.addr.port(), uri)
format!("http://localhost:{}/{}", self.addr.port(), uri)
}
}
/// Construct test https server url
pub fn surl(&self, uri: &str) -> String {
if uri.starts_with('/') {
format!("https://127.0.0.1:{}{}", self.addr.port(), uri)
format!("https://localhost:{}{}", self.addr.port(), uri)
} else {
format!("https://127.0.0.1:{}/{}", self.addr.port(), uri)
format!("https://localhost:{}/{}", self.addr.port(), uri)
}
}