merge master. update actix to 0.11.0

This commit is contained in:
fakeshadow 2021-01-02 10:25:32 +08:00
commit 35138f30b0
14 changed files with 31 additions and 25 deletions

View File

@ -1,6 +1,6 @@
# Changes # Changes
## Unreleased - 2020-xx-xx ## Unreleased - 2021-xx-xx
### Changed ### Changed
* Bumped `rand` to `0.8` * Bumped `rand` to `0.8`
* Update `rust-tls` to `0.19.0` * Update `rust-tls` to `0.19.0`
@ -14,6 +14,7 @@
[#1812]: https://github.com/actix/actix-web/pull/1812 [#1812]: https://github.com/actix/actix-web/pull/1812
[#1852]: https://github.com/actix/actix-web/pull/1852 [#1852]: https://github.com/actix/actix-web/pull/1852
## 3.3.2 - 2020-12-01 ## 3.3.2 - 2020-12-01
### Fixed ### Fixed
* Removed an occasional `unwrap` on `None` panic in `NormalizePathNormalization`. [#1762] * Removed an occasional `unwrap` on `None` panic in `NormalizePathNormalization`. [#1762]

View File

@ -105,10 +105,10 @@ time = { version = "0.2.7", default-features = false, features = ["std"] }
url = "2.1" url = "2.1"
open-ssl = { package = "openssl", version = "0.10", optional = true } open-ssl = { package = "openssl", version = "0.10", optional = true }
rust-tls = { package = "rustls", version = "0.19.0", optional = true } rust-tls = { package = "rustls", version = "0.19.0", optional = true }
tinyvec = { version = "1", features = ["alloc"] } smallvec = "1.6"
[dev-dependencies] [dev-dependencies]
actix = "0.10.0" actix = "0.11.0-beta.1"
actix-http = { version = "2.2.0", features = ["actors"] } actix-http = { version = "2.2.0", features = ["actors"] }
rand = "0.8" rand = "0.8"
env_logger = "0.8" env_logger = "0.8"
@ -131,8 +131,7 @@ actix-multipart = { path = "actix-multipart" }
actix-files = { path = "actix-files" } actix-files = { path = "actix-files" }
awc = { path = "awc" } awc = { path = "awc" }
# FIXME: remove these override actix = { git = "https://github.com/actix/actix.git", branch = "master" }
actix = { git = "https://github.com/fakeshadow/actix.git", branch = "master" }
actix-tls = { git = "https://github.com/actix/actix-net.git", branch = "master" } actix-tls = { git = "https://github.com/actix/actix-net.git", branch = "master" }
actix-server = { git = "https://github.com/actix/actix-net.git", branch = "master" } actix-server = { git = "https://github.com/actix/actix-net.git", branch = "master" }
actix-service = { git = "https://github.com/actix/actix-net.git", branch = "master" } actix-service = { git = "https://github.com/actix/actix-net.git", branch = "master" }

View File

@ -107,5 +107,5 @@ at your option.
## Code of Conduct ## Code of Conduct
Contribution to the actix-web crate is organized under the terms of the Contributor Covenant, the Contribution to the actix-web repo is organized under the terms of the Contributor Covenant.
maintainers of Actix web, promises to intervene to uphold that code of conduct. The Actix team promises to intervene to uphold that code of conduct.

View File

@ -1,8 +1,8 @@
# Changes # Changes
## Unreleased - 2020-xx-xx ## Unreleased - 2021-xx-xx
* Update `bytes` to `1`.
* `HttpRange::parse` now has its own error type. * `HttpRange::parse` now has its own error type.
* Update `bytes` to `1`.
## 0.5.0 - 2020-12-26 ## 0.5.0 - 2020-12-26

View File

@ -1,6 +1,6 @@
# Changes # Changes
## Unreleased - 2020-xx-xx ## Unreleased - 2021-xx-xx
* Update `bytes` to `1`. * Update `bytes` to `1`.

View File

@ -1,11 +1,12 @@
# Changes # Changes
## Unreleased - 2020-xx-xx ## Unreleased - 2021-xx-xx
### Changed ### Changed
* Bumped `rand` to `0.8` * Bumped `rand` to `0.8`
* Upgrade `bytes` to `1` * Upgrade `bytes` to `1`
* Upgrade `h2` to `0.3` * Upgrade `h2` to `0.3`
### Removed ### Removed
* Deprecated `on_connect` methods have been removed. Prefer the new * Deprecated `on_connect` methods have been removed. Prefer the new
`on_connect_ext` technique. [#1857] `on_connect_ext` technique. [#1857]

View File

@ -46,7 +46,7 @@ actix-utils = "3.0.0-beta.1"
actix-rt = "2.0.0-beta.1" actix-rt = "2.0.0-beta.1"
actix-threadpool = "0.3.1" actix-threadpool = "0.3.1"
actix-tls = "3.0.0-beta.1" actix-tls = "3.0.0-beta.1"
actix = { version = "0.10.0", optional = true } actix = { version = "0.11.0-beta.1", optional = true }
base64 = "0.13" base64 = "0.13"
bitflags = "1.2" bitflags = "1.2"

View File

@ -1,6 +1,6 @@
# Changes # Changes
## Unreleased - 2020-xx-xx ## Unreleased - 2021-xx-xx
* Fix multipart consuming payload before header checks #1513 * Fix multipart consuming payload before header checks #1513
* Update `bytes` to `1` * Update `bytes` to `1`

View File

@ -1,9 +1,10 @@
# Changes # Changes
## Unreleased - 2020-xx-xx ## Unreleased - 2021-xx-xx
* Upgrade `pin-project` to `1.0`. * Upgrade `pin-project` to `1.0`.
* Update `bytes` to `1`. * Update `bytes` to `1`.
## 3.0.0 - 2020-09-11 ## 3.0.0 - 2020-09-11
* No significant changes from `3.0.0-beta.2`. * No significant changes from `3.0.0-beta.2`.

View File

@ -16,7 +16,7 @@ name = "actix_web_actors"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
actix = "0.10.0" actix = "0.11.0-beta.1"
actix-codec = "0.4.0-beta.1" actix-codec = "0.4.0-beta.1"
actix-http = "2.0.0" actix-http = "2.0.0"
actix-web = { version = "3.0.0", default-features = false } actix-web = { version = "3.0.0", default-features = false }

View File

@ -1,6 +1,6 @@
# Changes # Changes
## Unreleased - 2020-xx-xx ## Unreleased - 2021-xx-xx
## 0.4.0 - 2020-09-20 ## 0.4.0 - 2020-09-20

View File

@ -1,6 +1,6 @@
# Changes # Changes
## Unreleased - 2020-xx-xx ## Unreleased - 2021-xx-xx
### Changed ### Changed
* Upgrade `bytes` to `1`. * Upgrade `bytes` to `1`.
* Bumped `rand` to `0.8` * Bumped `rand` to `0.8`

View File

@ -10,7 +10,6 @@ use actix_router::{Path, ResourceDef, ResourceInfo, Router, Url};
use actix_service::boxed::{self, BoxService, BoxServiceFactory}; use actix_service::boxed::{self, BoxService, BoxServiceFactory};
use actix_service::{fn_service, Service, ServiceFactory}; use actix_service::{fn_service, Service, ServiceFactory};
use futures_util::future::{join_all, ok, FutureExt, LocalBoxFuture}; use futures_util::future::{join_all, ok, FutureExt, LocalBoxFuture};
use tinyvec::tiny_vec;
use crate::config::{AppConfig, AppService}; use crate::config::{AppConfig, AppService};
use crate::data::{DataFactory, FnDataFactory}; use crate::data::{DataFactory, FnDataFactory};
@ -244,7 +243,6 @@ where
inner.path.reset(); inner.path.reset();
inner.head = head; inner.head = head;
inner.payload = payload; inner.payload = payload;
inner.app_data = tiny_vec![self.data.clone()];
req req
} else { } else {
HttpRequest::new( HttpRequest::new(

View File

@ -6,7 +6,7 @@ use actix_http::http::{HeaderMap, Method, Uri, Version};
use actix_http::{Error, Extensions, HttpMessage, Message, Payload, RequestHead}; use actix_http::{Error, Extensions, HttpMessage, Message, Payload, RequestHead};
use actix_router::{Path, Url}; use actix_router::{Path, Url};
use futures_util::future::{ok, Ready}; use futures_util::future::{ok, Ready};
use tinyvec::TinyVec; use smallvec::SmallVec;
use crate::config::AppConfig; use crate::config::AppConfig;
use crate::error::UrlGenerationError; use crate::error::UrlGenerationError;
@ -22,7 +22,7 @@ pub(crate) struct HttpRequestInner {
pub(crate) head: Message<RequestHead>, pub(crate) head: Message<RequestHead>,
pub(crate) path: Path<Url>, pub(crate) path: Path<Url>,
pub(crate) payload: Payload, pub(crate) payload: Payload,
pub(crate) app_data: TinyVec<[Rc<Extensions>; 4]>, pub(crate) app_data: SmallVec<[Rc<Extensions>; 4]>,
rmap: Rc<ResourceMap>, rmap: Rc<ResourceMap>,
config: AppConfig, config: AppConfig,
pool: &'static HttpRequestPool, pool: &'static HttpRequestPool,
@ -39,7 +39,7 @@ impl HttpRequest {
app_data: Rc<Extensions>, app_data: Rc<Extensions>,
pool: &'static HttpRequestPool, pool: &'static HttpRequestPool,
) -> HttpRequest { ) -> HttpRequest {
let mut data = TinyVec::<[Rc<Extensions>; 4]>::new(); let mut data = SmallVec::<[Rc<Extensions>; 4]>::new();
data.push(app_data); data.push(app_data);
HttpRequest(Rc::new(HttpRequestInner { HttpRequest(Rc::new(HttpRequestInner {
@ -277,10 +277,16 @@ impl HttpMessage for HttpRequest {
impl Drop for HttpRequest { impl Drop for HttpRequest {
fn drop(&mut self) { fn drop(&mut self) {
// if possible, contribute to current worker's HttpRequest allocation pool // if possible, contribute to current worker's HttpRequest allocation pool
if Rc::strong_count(&self.0) == 1 {
let v = &mut self.0.pool.0.borrow_mut(); // This relies on no Weak<HttpRequestInner> exists anywhere.(There is none)
if let Some(inner) = Rc::get_mut(&mut self.0) {
let v = &mut inner.pool.0.borrow_mut();
if v.len() < 128 { if v.len() < 128 {
self.extensions_mut().clear(); // clear additional app_data and keep the root one for reuse.
inner.app_data.truncate(1);
// inner is borrowed mut here. get head's Extension mutably
// to reduce borrow check
inner.head.extensions.get_mut().clear();
v.push(self.0.clone()); v.push(self.0.clone());
} }
} }