mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-18 22:01:50 +01:00
rollback changes to actix-web, awc and test-server for now
This commit is contained in:
parent
62aba424e2
commit
09a391a3ca
@ -33,8 +33,8 @@ members = [
|
|||||||
"actix-cors",
|
"actix-cors",
|
||||||
"actix-files",
|
"actix-files",
|
||||||
"actix-framed",
|
"actix-framed",
|
||||||
"actix-session",
|
# "actix-session",
|
||||||
"actix-identity",
|
# "actix-identity",
|
||||||
"actix-multipart",
|
"actix-multipart",
|
||||||
"actix-web-actors",
|
"actix-web-actors",
|
||||||
"actix-web-codegen",
|
"actix-web-codegen",
|
||||||
@ -71,8 +71,8 @@ actix-threadpool = "0.3.1"
|
|||||||
actix-tls = "1.0.0"
|
actix-tls = "1.0.0"
|
||||||
|
|
||||||
actix-web-codegen = "0.2.0"
|
actix-web-codegen = "0.2.0"
|
||||||
actix-http = { version = "2.0.0", path = "actix-http" }
|
actix-http = { version = "1.0.1" }
|
||||||
awc = { version = "2.0.0", path = "awc", default-features = false }
|
awc = { version = "1.0.1", default-features = false }
|
||||||
|
|
||||||
bytes = "0.5.3"
|
bytes = "0.5.3"
|
||||||
derive_more = "0.99.2"
|
derive_more = "0.99.2"
|
||||||
|
@ -383,7 +383,7 @@ where
|
|||||||
{
|
{
|
||||||
pub fn new(stream: S) -> Self {
|
pub fn new(stream: S) -> Self {
|
||||||
BodyStream {
|
BodyStream {
|
||||||
stream: Box::pin(stream),
|
stream,
|
||||||
_t: PhantomData,
|
_t: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -420,7 +420,8 @@ where
|
|||||||
#[pin_project]
|
#[pin_project]
|
||||||
pub struct SizedStream<S: Unpin> {
|
pub struct SizedStream<S: Unpin> {
|
||||||
size: u64,
|
size: u64,
|
||||||
stream: Pin<Box<S>>,
|
#[pin]
|
||||||
|
stream: S,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> SizedStream<S>
|
impl<S> SizedStream<S>
|
||||||
@ -428,10 +429,7 @@ where
|
|||||||
S: Stream<Item = Result<Bytes, Error>> + Unpin,
|
S: Stream<Item = Result<Bytes, Error>> + Unpin,
|
||||||
{
|
{
|
||||||
pub fn new(size: u64, stream: S) -> Self {
|
pub fn new(size: u64, stream: S) -> Self {
|
||||||
SizedStream {
|
SizedStream { size, stream }
|
||||||
size,
|
|
||||||
stream: Box::pin(stream),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,9 @@ async fn service(msg: ws::Frame) -> Result<ws::Message, Error> {
|
|||||||
Ok(msg)
|
Ok(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Temporarily commented out due to dependency on actix-http-test
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn test_simple() {
|
async fn test_simple() {
|
||||||
let ws_service = WsService::new();
|
let ws_service = WsService::new();
|
||||||
@ -192,3 +195,5 @@ async fn test_simple() {
|
|||||||
|
|
||||||
assert!(ws_service.was_polled());
|
assert!(ws_service.was_polled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "awc"
|
name = "awc"
|
||||||
version = "2.0.0"
|
version = "1.0.1"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Actix http client."
|
description = "Actix http client."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@ -36,7 +36,7 @@ compress = ["actix-http/compress"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
actix-codec = "0.2.0"
|
actix-codec = "0.2.0"
|
||||||
actix-service = "1.0.1"
|
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"
|
actix-rt = "1.0.0"
|
||||||
|
|
||||||
base64 = "0.11"
|
base64 = "0.11"
|
||||||
@ -55,9 +55,9 @@ rust-tls = { version = "0.16.0", package="rustls", optional = true, features = [
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
actix-connect = { version = "1.0.1", features=["openssl"] }
|
actix-connect = { version = "1.0.1", features=["openssl"] }
|
||||||
actix-web = { version = "3.0.0", path = "..", features=["openssl"] }
|
actix-web = { version = "2.0.0", features=["openssl"] }
|
||||||
actix-http = { version = "2.0.0", path = "../actix-http", features=["openssl"] }
|
actix-http = { version = "1.0.1", features=["openssl"] }
|
||||||
actix-http-test = { version = "2.0.0", path = "../test-server", features=["openssl"] }
|
actix-http-test = { version = "1.0.0", features=["openssl"] }
|
||||||
actix-utils = "1.0.3"
|
actix-utils = "1.0.3"
|
||||||
actix-server = "1.0.0"
|
actix-server = "1.0.0"
|
||||||
actix-tls = { version = "1.0.0", features=["openssl", "rustls"] }
|
actix-tls = { version = "1.0.0", features=["openssl", "rustls"] }
|
||||||
|
@ -238,24 +238,19 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use pin_project::{pin_project, pinned_drop};
|
|
||||||
#[pin_project(PinnedDrop)]
|
|
||||||
pub struct StreamLog<B> {
|
pub struct StreamLog<B> {
|
||||||
#[pin]
|
|
||||||
body: ResponseBody<B>,
|
body: ResponseBody<B>,
|
||||||
format: Option<Format>,
|
format: Option<Format>,
|
||||||
size: usize,
|
size: usize,
|
||||||
time: OffsetDateTime,
|
time: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pinned_drop]
|
impl<B> Drop for StreamLog<B> {
|
||||||
impl<B> PinnedDrop for StreamLog<B> {
|
fn drop(&mut self) {
|
||||||
fn drop(self: Pin<&mut Self>) {
|
if let Some(ref format) = self.format {
|
||||||
let this = self.project();
|
|
||||||
if let Some(ref format) = this.format {
|
|
||||||
let render = |fmt: &mut Formatter<'_>| {
|
let render = |fmt: &mut Formatter<'_>| {
|
||||||
for unit in &format.0 {
|
for unit in &format.0 {
|
||||||
unit.render(fmt, *this.size, *this.time)?;
|
unit.render(fmt, self.size, self.time)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
};
|
};
|
||||||
@ -269,11 +264,10 @@ impl<B: MessageBody> MessageBody for StreamLog<B> {
|
|||||||
self.body.size()
|
self.body.size()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Result<Bytes, Error>>> {
|
fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<Option<Result<Bytes, Error>>> {
|
||||||
let this = self.project();
|
match self.body.poll_next(cx) {
|
||||||
match this.body.poll_next(cx) {
|
|
||||||
Poll::Ready(Some(Ok(chunk))) => {
|
Poll::Ready(Some(Ok(chunk))) => {
|
||||||
*this.size += chunk.len();
|
self.size += chunk.len();
|
||||||
Poll::Ready(Some(Ok(chunk)))
|
Poll::Ready(Some(Ok(chunk)))
|
||||||
}
|
}
|
||||||
val => val,
|
val => val,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-http-test"
|
name = "actix-http-test"
|
||||||
version = "2.0.0"
|
version = "1.0.0"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Actix http test server"
|
description = "Actix http test server"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@ -37,7 +37,7 @@ actix-utils = "1.0.3"
|
|||||||
actix-rt = "1.0.0"
|
actix-rt = "1.0.0"
|
||||||
actix-server = "1.0.0"
|
actix-server = "1.0.0"
|
||||||
actix-testing = "1.0.0"
|
actix-testing = "1.0.0"
|
||||||
awc = { version = "2.0.0", path = "../awc" }
|
awc = { version = "1.0.1" }
|
||||||
|
|
||||||
base64 = "0.11"
|
base64 = "0.11"
|
||||||
bytes = "0.5.3"
|
bytes = "0.5.3"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user