1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-11 09:49:29 +00:00

rollback changes to actix-web, awc and test-server for now

This commit is contained in:
Maksym Vorobiov 2020-01-31 10:29:10 +02:00 committed by Yuki Okushi
parent 62aba424e2
commit 09a391a3ca
6 changed files with 27 additions and 30 deletions

View file

@ -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"

View file

@ -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<S: Unpin> {
size: u64,
stream: Pin<Box<S>>,
#[pin]
stream: S,
}
impl<S> SizedStream<S>
@ -428,10 +429,7 @@ where
S: Stream<Item = Result<Bytes, Error>> + Unpin,
{
pub fn new(size: u64, stream: S) -> Self {
SizedStream {
size,
stream: Box::pin(stream),
}
SizedStream { size, stream }
}
}

View file

@ -81,6 +81,9 @@ async fn service(msg: ws::Frame) -> Result<ws::Message, Error> {
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());
}
*/

View file

@ -1,6 +1,6 @@
[package]
name = "awc"
version = "2.0.0"
version = "1.0.1"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
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"] }

View file

@ -238,24 +238,19 @@ where
}
}
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
pub struct StreamLog<B> {
#[pin]
body: ResponseBody<B>,
format: Option<Format>,
size: usize,
time: OffsetDateTime,
}
#[pinned_drop]
impl<B> PinnedDrop for StreamLog<B> {
fn drop(self: Pin<&mut Self>) {
let this = self.project();
if let Some(ref format) = this.format {
impl<B> Drop for StreamLog<B> {
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<B: MessageBody> MessageBody for StreamLog<B> {
self.body.size()
}
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Result<Bytes, Error>>> {
let this = self.project();
match this.body.poll_next(cx) {
fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<Option<Result<Bytes, Error>>> {
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,

View file

@ -1,6 +1,6 @@
[package]
name = "actix-http-test"
version = "2.0.0"
version = "1.0.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
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"