diff --git a/actix-server/Cargo.toml b/actix-server/Cargo.toml index e4a9482d..126ee37b 100644 --- a/actix-server/Cargo.toml +++ b/actix-server/Cargo.toml @@ -26,9 +26,6 @@ nativetls = ["native-tls", "tokio-tls"] openssl = ["open-ssl", "tokio-openssl", "actix-server-config/openssl"] rustls = ["rust-tls", "tokio-rustls", "webpki", "webpki-roots", "actix-server-config/rustls"] -# uds -# uds = ["mio-uds", "tokio-uds", "actix-server-config/uds"] - [dependencies] actix-rt = "1.0.0-alpha.1" actix-service = "1.0.0-alpha.1" @@ -49,7 +46,6 @@ tokio-timer = "0.3.0-alpha.6" # unix domain sockets mio-uds = { version = "0.6.7", optional = true } -#tokio-uds = { version="0.2.5", optional = true } # nativetls native-tls = { version = "0.2", optional = true } @@ -61,7 +57,8 @@ tokio-openssl = { version = "0.4.0-alpha.6", optional = true } # rustls rust-tls = { version = "0.16.0", package = "rustls", optional = true } -tokio-rustls = { version = "0.12.0-alpha.2", optional = true } +# tokio-rustls = { version = "0.12.0-alpha.2", optional = true } +tokio-rustls = { git = "https://github.com/quininer/tokio-rustls.git", branch = "tokio-0.2", optional = true } webpki = { version = "0.21", optional = true } webpki-roots = { version = "0.17", optional = true } diff --git a/actix-server/src/ssl/mod.rs b/actix-server/src/ssl/mod.rs index d7c2a105..e9a8da87 100644 --- a/actix-server/src/ssl/mod.rs +++ b/actix-server/src/ssl/mod.rs @@ -13,10 +13,10 @@ mod nativetls; #[cfg(feature = "nativetls")] pub use self::nativetls::NativeTlsAcceptor; -//#[cfg(feature = "rustls")] -//mod rustls; -//#[cfg(feature = "rustls")] -//pub use self::rustls::RustlsAcceptor; +#[cfg(feature = "rustls")] +mod rustls; +#[cfg(feature = "rustls")] +pub use self::rustls::RustlsAcceptor; /// Sets the maximum per-worker concurrent ssl connection establish process. /// diff --git a/actix-server/src/ssl/rustls.rs b/actix-server/src/ssl/rustls.rs index c56ebb9c..f2c30f60 100644 --- a/actix-server/src/ssl/rustls.rs +++ b/actix-server/src/ssl/rustls.rs @@ -43,7 +43,7 @@ impl Clone for RustlsAcceptor { } } -impl ServiceFactory for RustlsAcceptor { +impl ServiceFactory for RustlsAcceptor { type Request = Io; type Response = Io, P>; type Error = io::Error; @@ -72,13 +72,13 @@ pub struct RustlsAcceptorService { conns: Counter, } -impl Service for RustlsAcceptorService { +impl Service for RustlsAcceptorService { type Request = Io; type Response = Io, P>; type Error = io::Error; type Future = RustlsAcceptorServiceFut; - fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { + fn poll_ready(&mut self, cx: &mut Context) -> Poll> { if self.conns.available(cx) { Poll::Ready(Ok(())) } else { @@ -99,7 +99,7 @@ impl Service for RustlsAcceptorService { #[pin_project] pub struct RustlsAcceptorServiceFut where - T: AsyncRead + AsyncWrite, + T: AsyncRead + AsyncWrite + Unpin, { #[pin] fut: Accept, @@ -107,16 +107,15 @@ where _guard: CounterGuard, } -impl Future for RustlsAcceptorServiceFut { +impl Future for RustlsAcceptorServiceFut { type Output = Result, P>, io::Error>; fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { let this = self.project(); - let io = futures::ready!(this.fut.poll(cx)); - Poll::Ready(Ok(Io::from_parts( - io, - this.params.take().unwrap(), - Protocol::Unknown, - ))) + let params = this.params.take().unwrap(); + Poll::Ready( + futures::ready!(this.fut.poll(cx)) + .map(move |io| Io::from_parts(io, params, Protocol::Unknown)), + ) } }