From 09a391a3ca598a8be03f41c656ab70706fd6d2bd Mon Sep 17 00:00:00 2001 From: Maksym Vorobiov Date: Fri, 31 Jan 2020 10:29:10 +0200 Subject: [PATCH] rollback changes to actix-web, awc and test-server for now --- Cargo.toml | 8 ++++---- actix-http/src/body.rs | 10 ++++------ actix-http/tests/test_ws.rs | 5 +++++ awc/Cargo.toml | 10 +++++----- src/middleware/logger.rs | 20 +++++++------------- test-server/Cargo.toml | 4 ++-- 6 files changed, 27 insertions(+), 30 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 11d6292a1..b9b647568 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,8 +33,8 @@ members = [ "actix-cors", "actix-files", "actix-framed", - "actix-session", - "actix-identity", +# "actix-session", +# "actix-identity", "actix-multipart", "actix-web-actors", "actix-web-codegen", @@ -71,8 +71,8 @@ actix-threadpool = "0.3.1" actix-tls = "1.0.0" actix-web-codegen = "0.2.0" -actix-http = { version = "2.0.0", path = "actix-http" } -awc = { version = "2.0.0", path = "awc", default-features = false } +actix-http = { version = "1.0.1" } +awc = { version = "1.0.1", default-features = false } bytes = "0.5.3" derive_more = "0.99.2" diff --git a/actix-http/src/body.rs b/actix-http/src/body.rs index ea742af5f..74e6e218d 100644 --- a/actix-http/src/body.rs +++ b/actix-http/src/body.rs @@ -383,7 +383,7 @@ where { pub fn new(stream: S) -> Self { BodyStream { - stream: Box::pin(stream), + stream, _t: PhantomData, } } @@ -420,7 +420,8 @@ where #[pin_project] pub struct SizedStream { size: u64, - stream: Pin>, + #[pin] + stream: S, } impl SizedStream @@ -428,10 +429,7 @@ where S: Stream> + Unpin, { pub fn new(size: u64, stream: S) -> Self { - SizedStream { - size, - stream: Box::pin(stream), - } + SizedStream { size, stream } } } diff --git a/actix-http/tests/test_ws.rs b/actix-http/tests/test_ws.rs index 7152fee48..2f2a28e2f 100644 --- a/actix-http/tests/test_ws.rs +++ b/actix-http/tests/test_ws.rs @@ -81,6 +81,9 @@ async fn service(msg: ws::Frame) -> Result { Ok(msg) } +/* +Temporarily commented out due to dependency on actix-http-test + #[actix_rt::test] async fn test_simple() { let ws_service = WsService::new(); @@ -192,3 +195,5 @@ async fn test_simple() { assert!(ws_service.was_polled()); } + +*/ \ No newline at end of file diff --git a/awc/Cargo.toml b/awc/Cargo.toml index 71623e2dc..f7d5634e0 100644 --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "awc" -version = "2.0.0" +version = "1.0.1" authors = ["Nikolay Kim "] description = "Actix http client." readme = "README.md" @@ -36,7 +36,7 @@ compress = ["actix-http/compress"] [dependencies] actix-codec = "0.2.0" actix-service = "1.0.1" -actix-http = { version = "2.0.0", path = "../actix-http" } +actix-http = { version = "1.0.1" } actix-rt = "1.0.0" base64 = "0.11" @@ -55,9 +55,9 @@ rust-tls = { version = "0.16.0", package="rustls", optional = true, features = [ [dev-dependencies] actix-connect = { version = "1.0.1", features=["openssl"] } -actix-web = { version = "3.0.0", path = "..", features=["openssl"] } -actix-http = { version = "2.0.0", path = "../actix-http", features=["openssl"] } -actix-http-test = { version = "2.0.0", path = "../test-server", features=["openssl"] } +actix-web = { version = "2.0.0", features=["openssl"] } +actix-http = { version = "1.0.1", features=["openssl"] } +actix-http-test = { version = "1.0.0", features=["openssl"] } actix-utils = "1.0.3" actix-server = "1.0.0" actix-tls = { version = "1.0.0", features=["openssl", "rustls"] } diff --git a/src/middleware/logger.rs b/src/middleware/logger.rs index 661ced966..d692132ce 100644 --- a/src/middleware/logger.rs +++ b/src/middleware/logger.rs @@ -238,24 +238,19 @@ where } } -use pin_project::{pin_project, pinned_drop}; -#[pin_project(PinnedDrop)] pub struct StreamLog { - #[pin] body: ResponseBody, format: Option, size: usize, time: OffsetDateTime, } -#[pinned_drop] -impl PinnedDrop for StreamLog { - fn drop(self: Pin<&mut Self>) { - let this = self.project(); - if let Some(ref format) = this.format { +impl Drop for StreamLog { + fn drop(&mut self) { + if let Some(ref format) = self.format { let render = |fmt: &mut Formatter<'_>| { for unit in &format.0 { - unit.render(fmt, *this.size, *this.time)?; + unit.render(fmt, self.size, self.time)?; } Ok(()) }; @@ -269,11 +264,10 @@ impl MessageBody for StreamLog { self.body.size() } - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll>> { - let this = self.project(); - match this.body.poll_next(cx) { + fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll>> { + match self.body.poll_next(cx) { Poll::Ready(Some(Ok(chunk))) => { - *this.size += chunk.len(); + self.size += chunk.len(); Poll::Ready(Some(Ok(chunk))) } val => val, diff --git a/test-server/Cargo.toml b/test-server/Cargo.toml index 7ea0a9ba4..51c25f8d1 100644 --- a/test-server/Cargo.toml +++ b/test-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-http-test" -version = "2.0.0" +version = "1.0.0" authors = ["Nikolay Kim "] description = "Actix http test server" readme = "README.md" @@ -37,7 +37,7 @@ actix-utils = "1.0.3" actix-rt = "1.0.0" actix-server = "1.0.0" actix-testing = "1.0.0" -awc = { version = "2.0.0", path = "../awc" } +awc = { version = "1.0.1" } base64 = "0.11" bytes = "0.5.3"