1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-20 04:35:38 +02:00

Compare commits

...

8 Commits

Author SHA1 Message Date
Nikolay Kim
a791aab418 prep awc release 2019-12-15 13:36:05 +06:00
Nikolay Kim
cb705317b8 compile with default-features off 2019-12-15 13:28:54 +06:00
Nikolay Kim
e8e0f98f96 fix docs.rs features list 2019-12-13 12:41:48 +06:00
Nikolay Kim
c878f66d05 fix docs.rs features list 2019-12-13 12:40:22 +06:00
Nikolay Kim
fac6dec3c9 update deps 2019-12-13 12:36:15 +06:00
Nikolay Kim
232f71b3b5 update changes 2019-12-13 12:18:30 +06:00
Nikolay Kim
8881c13e60 update changes 2019-12-13 12:16:43 +06:00
Nikolay Kim
d006a7b31f update changes 2019-12-13 12:10:45 +06:00
20 changed files with 126 additions and 49 deletions

View File

@@ -1,5 +1,11 @@
# Changes
## [2.0.0-alpha.5] - 2019-12-13
### Added
* Add test server, `test::start()` and `test::start_with()`
## [2.0.0-alpha.4] - 2019-12-08
### Deleted

View File

@@ -1,6 +1,6 @@
[package]
name = "actix-web"
version = "2.0.0-alpha.4"
version = "2.0.0-alpha.5"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
readme = "README.md"
@@ -16,7 +16,7 @@ exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"]
edition = "2018"
[package.metadata.docs.rs]
features = ["openssl", "compress", "secure-cookies", "client"]
features = ["openssl", "rustls", "compress", "secure-cookies"]
[badges]
travis-ci = { repository = "actix/actix-web", branch = "master" }
@@ -71,11 +71,11 @@ actix-macros = "0.1.0"
actix-threadpool = "0.3.0"
actix-tls = "1.0.0"
actix-web-codegen = "0.2.0-alpha.2"
actix-web-codegen = "0.2.0"
actix-http = "1.0.0"
awc = { version = "1.0.0", default-features = false }
bytes = "0.5.2"
bytes = "0.5.3"
derive_more = "0.99.2"
encoding_rs = "0.8"
futures = "0.3.1"

View File

@@ -1,6 +1,6 @@
[package]
name = "actix-cors"
version = "0.2.0-alpha.3"
version = "0.2.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Cross-origin resource sharing (CORS) for Actix applications."
readme = "README.md"
@@ -17,7 +17,7 @@ name = "actix_cors"
path = "src/lib.rs"
[dependencies]
actix-web = "2.0.0-alpha.3"
actix-web = "2.0.0-alpha.5"
actix-service = "1.0.0"
derive_more = "0.99.2"
futures = "0.3.1"

View File

@@ -1,6 +1,6 @@
[package]
name = "actix-files"
version = "0.2.0-alpha.3"
version = "0.2.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Static files support for actix web."
readme = "README.md"
@@ -18,11 +18,11 @@ name = "actix_files"
path = "src/lib.rs"
[dependencies]
actix-web = { version = "2.0.0-alpha.3", default-features = false }
actix-http = "1.0.0-alpha.3"
actix-web = { version = "2.0.0-alpha.5", default-features = false }
actix-http = "1.0.0"
actix-service = "1.0.0"
bitflags = "1"
bytes = "0.5.2"
bytes = "0.5.3"
futures = "0.3.1"
derive_more = "0.99.2"
log = "0.4"
@@ -33,4 +33,4 @@ v_htmlescape = "0.4"
[dev-dependencies]
actix-rt = "1.0.0"
actix-web = { version = "2.0.0-alpha.3", features=["openssl"] }
actix-web = { version = "2.0.0-alpha.5", features=["openssl"] }

View File

@@ -1,6 +1,6 @@
[package]
name = "actix-framed"
version = "0.3.0-alpha.1"
version = "0.3.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix framed app server"
readme = "README.md"
@@ -24,9 +24,9 @@ actix-codec = "0.2.0"
actix-service = "1.0.0"
actix-router = "0.2.0"
actix-rt = "1.0.0"
actix-http = "1.0.0-alpha.3"
actix-http = "1.0.0"
bytes = "0.5.2"
bytes = "0.5.3"
futures = "0.3.1"
pin-project = "0.4.6"
log = "0.4"
@@ -34,5 +34,5 @@ log = "0.4"
[dev-dependencies]
actix-server = "1.0.0"
actix-connect = { version = "1.0.0", features=["openssl"] }
actix-http-test = { version = "1.0.0-alpha.3", features=["openssl"] }
actix-utils = "1.0.0"
actix-http-test = { version = "1.0.0", features=["openssl"] }
actix-utils = "1.0.3"

View File

@@ -15,7 +15,7 @@ license = "MIT/Apache-2.0"
edition = "2018"
[package.metadata.docs.rs]
features = ["openssl", "rustls", "fail", "compress", "secure-cookies"]
features = ["openssl", "rustls", "failure", "compress", "secure-cookies"]
[lib]
name = "actix_http"
@@ -42,7 +42,7 @@ secure-cookies = ["ring"]
[dependencies]
actix-service = "1.0.0"
actix-codec = "0.2.0"
actix-connect = "1.0.0"
actix-connect = "1.0.1"
actix-utils = "1.0.3"
actix-rt = "1.0.0"
actix-threadpool = "0.3.1"
@@ -92,7 +92,7 @@ fail-ure = { version = "0.1.5", package="failure", optional = true }
[dev-dependencies]
actix-server = "1.0.0"
actix-connect = { version = "1.0.0", features=["openssl"] }
actix-http-test = { version = "1.0.0-alpha.3", features=["openssl"] }
actix-http-test = { version = "1.0.0", features=["openssl"] }
actix-tls = { version = "1.0.0", features=["openssl"] }
futures = "0.3.1"
env_logger = "0.6"

View File

@@ -1,6 +1,6 @@
[package]
name = "actix-identity"
version = "0.2.0-alpha.3"
version = "0.2.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Identity service for actix web framework."
readme = "README.md"
@@ -17,7 +17,7 @@ name = "actix_identity"
path = "src/lib.rs"
[dependencies]
actix-web = { version = "2.0.0-alpha.3", default-features = false, features = ["secure-cookies"] }
actix-web = { version = "2.0.0-alpha.5", default-features = false, features = ["secure-cookies"] }
actix-service = "1.0.0"
futures = "0.3.1"
serde = "1.0"
@@ -26,5 +26,5 @@ time = "0.1.42"
[dev-dependencies]
actix-rt = "1.0.0"
actix-http = "1.0.0-alpha.3"
bytes = "0.5.2"
actix-http = "1.0.0"
bytes = "0.5.3"

View File

@@ -1,6 +1,6 @@
[package]
name = "actix-multipart"
version = "0.2.0-alpha.3"
version = "0.2.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Multipart support for actix web framework."
readme = "README.md"
@@ -9,8 +9,6 @@ homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-web.git"
documentation = "https://docs.rs/actix-multipart/"
license = "MIT/Apache-2.0"
exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"]
workspace = ".."
edition = "2018"
[lib]
@@ -18,10 +16,10 @@ name = "actix_multipart"
path = "src/lib.rs"
[dependencies]
actix-web = { version = "2.0.0-alpha.3", default-features = false }
actix-web = { version = "2.0.0-alpha.5", default-features = false }
actix-service = "1.0.0"
actix-utils = "1.0.0"
bytes = "0.5.2"
actix-utils = "1.0.3"
bytes = "0.5.3"
derive_more = "0.99.2"
httparse = "1.3"
futures = "0.3.1"
@@ -32,4 +30,4 @@ twoway = "0.2"
[dev-dependencies]
actix-rt = "1.0.0"
actix-http = "1.0.0-alpha.3"
actix-http = "1.0.0"

View File

@@ -1,6 +1,6 @@
[package]
name = "actix-session"
version = "0.3.0-alpha.3"
version = "0.3.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Session for actix web framework."
readme = "README.md"
@@ -9,8 +9,6 @@ homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-web.git"
documentation = "https://docs.rs/actix-session/"
license = "MIT/Apache-2.0"
exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"]
workspace = ".."
edition = "2018"
[lib]
@@ -24,9 +22,9 @@ default = ["cookie-session"]
cookie-session = ["actix-web/secure-cookies"]
[dependencies]
actix-web = "2.0.0-alpha.3"
actix-web = "2.0.0-alpha.5"
actix-service = "1.0.0"
bytes = "0.5.2"
bytes = "0.5.3"
derive_more = "0.99.2"
futures = "0.3.1"
serde = "1.0"

View File

@@ -1,5 +1,9 @@
# Changes
## [0.2.0] - 2019-12-13
* Generate code for actix-web 2.0
## [0.1.3] - 2019-10-14
* Bump up `syn` & `quote` to 1.0

View File

@@ -1,5 +1,10 @@
# Changes
## [1.0.1] - 2019-12-15
* Fix compilation with default features off
## [1.0.0] - 2019-12-13
* Release

View File

@@ -1,6 +1,6 @@
[package]
name = "awc"
version = "1.0.0"
version = "1.0.1"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix http client."
readme = "README.md"
@@ -40,7 +40,7 @@ actix-http = "1.0.0"
actix-rt = "1.0.0"
base64 = "0.11"
bytes = "0.5.2"
bytes = "0.5.3"
derive_more = "0.99.2"
futures-core = "0.3.1"
log =" 0.4"
@@ -54,11 +54,11 @@ open-ssl = { version="0.10", package="openssl", optional = true }
rust-tls = { version = "0.16.0", package="rustls", optional = true, features = ["dangerous_configuration"] }
[dev-dependencies]
actix-connect = { version = "1.0.0", features=["openssl"] }
actix-web = { version = "2.0.0-alpha.3", features=["openssl"] }
actix-connect = { version = "1.0.1", features=["openssl"] }
actix-web = { version = "2.0.0-alpha.5", features=["openssl"] }
actix-http = { version = "1.0.0", features=["openssl"] }
actix-http-test = { version = "1.0.0-alpha.3", features=["openssl"] }
actix-utils = "1.0.0"
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"] }
brotli = "3.3.0"

View File

@@ -7,15 +7,21 @@ use std::time::Duration;
use actix_rt::time::{delay_for, Delay};
use bytes::Bytes;
use derive_more::From;
use futures_core::{ready, Future, Stream};
use futures_core::{Future, Stream};
use serde::Serialize;
use serde_json;
use actix_http::body::{Body, BodyStream};
use actix_http::encoding::Decoder;
use actix_http::http::header::{self, ContentEncoding, IntoHeaderValue};
use actix_http::http::header::{self, IntoHeaderValue};
use actix_http::http::{Error as HttpError, HeaderMap, HeaderName};
use actix_http::{Error, Payload, PayloadStream, RequestHead};
use actix_http::{Error, RequestHead};
#[cfg(feature = "compress")]
use actix_http::encoding::Decoder;
#[cfg(feature = "compress")]
use actix_http::http::header::ContentEncoding;
#[cfg(feature = "compress")]
use actix_http::{Payload, PayloadStream};
use crate::error::{FreezeRequestError, InvalidUrl, SendRequestError};
use crate::response::ClientResponse;
@@ -67,6 +73,7 @@ impl SendClientRequest {
}
}
#[cfg(feature = "compress")]
impl Future for SendClientRequest {
type Output =
Result<ClientResponse<Decoder<Payload<PayloadStream>>>, SendRequestError>;
@@ -83,7 +90,7 @@ impl Future for SendClientRequest {
}
}
let res = ready!(Pin::new(send).poll(cx)).map(|res| {
let res = futures_core::ready!(Pin::new(send).poll(cx)).map(|res| {
res.map_body(|head, payload| {
if *response_decompress {
Payload::Stream(Decoder::from_headers(
@@ -109,6 +116,30 @@ impl Future for SendClientRequest {
}
}
#[cfg(not(feature = "compress"))]
impl Future for SendClientRequest {
type Output = Result<ClientResponse, SendRequestError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.get_mut();
match this {
SendClientRequest::Fut(send, delay, _) => {
if delay.is_some() {
match Pin::new(delay.as_mut().unwrap()).poll(cx) {
Poll::Pending => (),
_ => return Poll::Ready(Err(SendRequestError::Timeout)),
}
}
Pin::new(send).poll(cx)
}
SendClientRequest::Err(ref mut e) => match e.take() {
Some(e) => Poll::Ready(Err(e)),
None => panic!("Attempting to call completed future"),
},
}
}
}
impl From<SendRequestError> for SendClientRequest {
fn from(e: SendRequestError) -> Self {
SendClientRequest::Err(Some(e))

View File

@@ -141,6 +141,7 @@ pub mod dev {
pub use crate::types::readlines::Readlines;
pub use actix_http::body::{Body, BodySize, MessageBody, ResponseBody, SizedStream};
#[cfg(feature = "compress")]
pub use actix_http::encoding::Decoder as Decompress;
pub use actix_http::ResponseBuilder as HttpResponseBuilder;
pub use actix_http::{

View File

@@ -1,5 +1,8 @@
//! Middlewares
#[cfg(feature = "compress")]
mod compress;
#[cfg(feature = "compress")]
pub use self::compress::{BodyEncoding, Compress};
mod condition;

View File

@@ -14,6 +14,7 @@ use futures::StreamExt;
use serde::de::DeserializeOwned;
use serde::Serialize;
#[cfg(feature = "compress")]
use crate::dev::Decompress;
use crate::error::UrlencodedError;
use crate::extract::FromRequest;
@@ -240,7 +241,10 @@ impl Default for FormConfig {
/// * content-length is greater than 32k
///
pub struct UrlEncoded<U> {
#[cfg(feature = "compress")]
stream: Option<Decompress<Payload>>,
#[cfg(not(feature = "compress"))]
stream: Option<Payload>,
limit: usize,
length: Option<usize>,
encoding: &'static Encoding,
@@ -273,7 +277,11 @@ impl<U> UrlEncoded<U> {
}
};
#[cfg(feature = "compress")]
let payload = Decompress::from_headers(payload.take(), req.headers());
#[cfg(not(feature = "compress"))]
let payload = payload.take();
UrlEncoded {
encoding,
stream: Some(payload),

View File

@@ -16,6 +16,7 @@ use serde_json;
use actix_http::http::{header::CONTENT_LENGTH, StatusCode};
use actix_http::{HttpMessage, Payload, Response};
#[cfg(feature = "compress")]
use crate::dev::Decompress;
use crate::error::{Error, JsonPayloadError};
use crate::extract::FromRequest;
@@ -293,7 +294,10 @@ impl Default for JsonConfig {
pub struct JsonBody<U> {
limit: usize,
length: Option<usize>,
#[cfg(feature = "compress")]
stream: Option<Decompress<Payload>>,
#[cfg(not(feature = "compress"))]
stream: Option<Payload>,
err: Option<JsonPayloadError>,
fut: Option<LocalBoxFuture<'static, Result<U, JsonPayloadError>>>,
}
@@ -332,7 +336,11 @@ where
.get(&CONTENT_LENGTH)
.and_then(|l| l.to_str().ok())
.and_then(|s| s.parse::<usize>().ok());
#[cfg(feature = "compress")]
let payload = Decompress::from_headers(payload.take(), req.headers());
#[cfg(not(feature = "compress"))]
let payload = payload.take();
JsonBody {
limit: 262_144,

View File

@@ -301,7 +301,10 @@ impl Default for PayloadConfig {
pub struct HttpMessageBody {
limit: usize,
length: Option<usize>,
#[cfg(feature = "compress")]
stream: Option<dev::Decompress<dev::Payload>>,
#[cfg(not(feature = "compress"))]
stream: Option<dev::Payload>,
err: Option<PayloadError>,
fut: Option<LocalBoxFuture<'static, Result<Bytes, PayloadError>>>,
}
@@ -322,8 +325,13 @@ impl HttpMessageBody {
}
}
#[cfg(feature = "compress")]
let stream = Some(dev::Decompress::from_headers(payload.take(), req.headers()));
#[cfg(not(feature = "compress"))]
let stream = Some(payload.take());
HttpMessageBody {
stream: Some(dev::Decompress::from_headers(payload.take(), req.headers())),
stream,
limit: 262_144,
length: len,
fut: None,

View File

@@ -1,5 +1,12 @@
# Changes
## [1.0.0] - 2019-12-13
### Changed
* Replaced `TestServer::start()` with `test_server()`
## [1.0.0-alpha.3] - 2019-12-07
### Changed

View File

@@ -40,7 +40,7 @@ actix-testing = "1.0.0"
awc = "1.0.0"
base64 = "0.11"
bytes = "0.5.2"
bytes = "0.5.3"
futures = "0.3.1"
http = "0.2.0"
log = "0.4"
@@ -55,5 +55,5 @@ time = "0.1"
open-ssl = { version="0.10", package="openssl", optional = true }
[dev-dependencies]
actix-web = "2.0.0-alpha.4"
actix-web = "2.0.0-alpha.5"
actix-http = "1.0.0"