mirror of
https://github.com/actix/actix-web.git
synced 2024-12-17 13:46:36 +00:00
update changelog
This commit is contained in:
parent
d5ad250193
commit
d7a1b434cb
6 changed files with 23 additions and 15 deletions
|
@ -8,7 +8,7 @@
|
||||||
* `HttpResponse::map_into_{left,right}_body` and `HttpResponse::map_into_boxed_body`. [#2468]
|
* `HttpResponse::map_into_{left,right}_body` and `HttpResponse::map_into_boxed_body`. [#2468]
|
||||||
* `ServiceResponse::map_into_{left,right}_body` and `HttpResponse::map_into_boxed_body`. [#2468]
|
* `ServiceResponse::map_into_{left,right}_body` and `HttpResponse::map_into_boxed_body`. [#2468]
|
||||||
* Connection data set through the `HttpServer::on_connect` callback is now accessible only from the new `HttpRequest::conn_data()` and `ServiceRequest::conn_data()` methods. [#2491]
|
* Connection data set through the `HttpServer::on_connect` callback is now accessible only from the new `HttpRequest::conn_data()` and `ServiceRequest::conn_data()` methods. [#2491]
|
||||||
* `impl Clone` for `RequestHead`. [#2487]
|
* `HttpRequest::{req_data,req_data_mut}`. [#2487]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Rename `Accept::{mime_precedence => ranked}`. [#2480]
|
* Rename `Accept::{mime_precedence => ranked}`. [#2480]
|
||||||
|
@ -24,6 +24,9 @@
|
||||||
* Re-exports `dev::{BodySize, MessageBody, SizedStream}`. They are exposed through the `body` module. [#2468]
|
* Re-exports `dev::{BodySize, MessageBody, SizedStream}`. They are exposed through the `body` module. [#2468]
|
||||||
* Typed headers containing lists that require one or more items now enforce this minimum. [#2482]
|
* Typed headers containing lists that require one or more items now enforce this minimum. [#2482]
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
* `ConnectionInfo::get`. [#2487]
|
||||||
|
|
||||||
[#2430]: https://github.com/actix/actix-web/pull/2430
|
[#2430]: https://github.com/actix/actix-web/pull/2430
|
||||||
[#2468]: https://github.com/actix/actix-web/pull/2468
|
[#2468]: https://github.com/actix/actix-web/pull/2468
|
||||||
[#2480]: https://github.com/actix/actix-web/pull/2480
|
[#2480]: https://github.com/actix/actix-web/pull/2480
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
* `impl Display` for `header::Quality`. [#2486]
|
* `impl Display` for `header::Quality`. [#2486]
|
||||||
* Connection data set through the `on_connect_ext` callbacks is now accessible only from the new `Request::conn_data()` method. [#2491]
|
* Connection data set through the `on_connect_ext` callbacks is now accessible only from the new `Request::conn_data()` method. [#2491]
|
||||||
* `Request::take_conn_data()`. [#2491]
|
* `Request::take_conn_data()`. [#2491]
|
||||||
|
* `Request::take_req_data()`. [#2487]
|
||||||
|
* `impl Clone` for `RequestHead`. [#2487]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Rename `body::BoxBody::{from_body => new}`. [#2468]
|
* Rename `body::BoxBody::{from_body => new}`. [#2468]
|
||||||
|
@ -40,6 +42,7 @@
|
||||||
[#2468]: https://github.com/actix/actix-web/pull/2468
|
[#2468]: https://github.com/actix/actix-web/pull/2468
|
||||||
[#1920]: https://github.com/actix/actix-web/pull/1920
|
[#1920]: https://github.com/actix/actix-web/pull/1920
|
||||||
[#2486]: https://github.com/actix/actix-web/pull/2486
|
[#2486]: https://github.com/actix/actix-web/pull/2486
|
||||||
|
[#2487]: https://github.com/actix/actix-web/pull/2487
|
||||||
[#2488]: https://github.com/actix/actix-web/pull/2488
|
[#2488]: https://github.com/actix/actix-web/pull/2488
|
||||||
[#2491]: https://github.com/actix/actix-web/pull/2491
|
[#2491]: https://github.com/actix/actix-web/pull/2491
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,7 @@ impl Extensions {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new() -> Extensions {
|
pub fn new() -> Extensions {
|
||||||
Extensions {
|
Extensions {
|
||||||
map: AHashMap::with_capacity(2),
|
map: AHashMap::new(),
|
||||||
// map: AHashMap::new(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
cell::{Ref, RefCell, RefMut},
|
cell::{Ref, RefCell, RefMut},
|
||||||
fmt, net,
|
fmt, mem, net,
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
str,
|
str,
|
||||||
};
|
};
|
||||||
|
@ -22,7 +22,7 @@ pub struct Request<P = PayloadStream> {
|
||||||
pub(crate) payload: Payload<P>,
|
pub(crate) payload: Payload<P>,
|
||||||
pub(crate) head: Message<RequestHead>,
|
pub(crate) head: Message<RequestHead>,
|
||||||
pub(crate) conn_data: Option<Rc<Extensions>>,
|
pub(crate) conn_data: Option<Rc<Extensions>>,
|
||||||
pub req_data: RefCell<Extensions>,
|
pub(crate) req_data: RefCell<Extensions>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P> HttpMessage for Request<P> {
|
impl<P> HttpMessage for Request<P> {
|
||||||
|
@ -34,7 +34,7 @@ impl<P> HttpMessage for Request<P> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn take_payload(&mut self) -> Payload<P> {
|
fn take_payload(&mut self) -> Payload<P> {
|
||||||
std::mem::replace(&mut self.payload, Payload::None)
|
mem::replace(&mut self.payload, Payload::None)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Request extensions
|
/// Request extensions
|
||||||
|
@ -55,7 +55,7 @@ impl From<Message<RequestHead>> for Request<PayloadStream> {
|
||||||
Request {
|
Request {
|
||||||
head,
|
head,
|
||||||
payload: Payload::None,
|
payload: Payload::None,
|
||||||
req_data: RefCell::new(Extensions::new()),
|
req_data: RefCell::new(Extensions::default()),
|
||||||
conn_data: None,
|
conn_data: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ impl Request<PayloadStream> {
|
||||||
Request {
|
Request {
|
||||||
head: Message::new(),
|
head: Message::new(),
|
||||||
payload: Payload::None,
|
payload: Payload::None,
|
||||||
req_data: RefCell::new(Extensions::new()),
|
req_data: RefCell::new(Extensions::default()),
|
||||||
conn_data: None,
|
conn_data: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ impl<P> Request<P> {
|
||||||
Request {
|
Request {
|
||||||
payload,
|
payload,
|
||||||
head: Message::new(),
|
head: Message::new(),
|
||||||
req_data: RefCell::new(Extensions::new()),
|
req_data: RefCell::new(Extensions::default()),
|
||||||
conn_data: None,
|
conn_data: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ impl<P> Request<P> {
|
||||||
|
|
||||||
/// Get request's payload
|
/// Get request's payload
|
||||||
pub fn take_payload(&mut self) -> Payload<P> {
|
pub fn take_payload(&mut self) -> Payload<P> {
|
||||||
std::mem::replace(&mut self.payload, Payload::None)
|
mem::replace(&mut self.payload, Payload::None)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Split request into request head and payload
|
/// Split request into request head and payload
|
||||||
|
@ -203,6 +203,11 @@ impl<P> Request<P> {
|
||||||
pub fn take_conn_data(&mut self) -> Option<Rc<Extensions>> {
|
pub fn take_conn_data(&mut self) -> Option<Rc<Extensions>> {
|
||||||
self.conn_data.take()
|
self.conn_data.take()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the request data container, leaving an empty one in it's place.
|
||||||
|
pub fn take_req_data(&mut self) -> Extensions {
|
||||||
|
mem::take(&mut self.req_data.get_mut())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P> fmt::Debug for Request<P> {
|
impl<P> fmt::Debug for Request<P> {
|
||||||
|
|
|
@ -198,7 +198,7 @@ where
|
||||||
actix_service::forward_ready!(service);
|
actix_service::forward_ready!(service);
|
||||||
|
|
||||||
fn call(&self, mut req: Request) -> Self::Future {
|
fn call(&self, mut req: Request) -> Self::Future {
|
||||||
let req_data = Rc::new(RefCell::new(req.req_data.take()));
|
let req_data = Rc::new(RefCell::new(req.take_req_data()));
|
||||||
let conn_data = req.take_conn_data();
|
let conn_data = req.take_conn_data();
|
||||||
let (head, payload) = req.into_parts();
|
let (head, payload) = req.into_parts();
|
||||||
|
|
||||||
|
|
|
@ -325,18 +325,15 @@ impl HttpMessage for HttpRequest {
|
||||||
type Stream = ();
|
type Stream = ();
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
/// Returns Request's headers.
|
|
||||||
fn headers(&self) -> &HeaderMap {
|
fn headers(&self) -> &HeaderMap {
|
||||||
&self.head().headers
|
&self.head().headers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Request extensions
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn extensions(&self) -> Ref<'_, Extensions> {
|
fn extensions(&self) -> Ref<'_, Extensions> {
|
||||||
self.req_data()
|
self.req_data()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mutable reference to a the request's extensions
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn extensions_mut(&self) -> RefMut<'_, Extensions> {
|
fn extensions_mut(&self) -> RefMut<'_, Extensions> {
|
||||||
self.req_data_mut()
|
self.req_data_mut()
|
||||||
|
@ -358,7 +355,8 @@ impl Drop for HttpRequest {
|
||||||
// clear additional app_data and keep the root one for reuse.
|
// clear additional app_data and keep the root one for reuse.
|
||||||
inner.app_data.truncate(1);
|
inner.app_data.truncate(1);
|
||||||
|
|
||||||
// inner is borrowed mut here; get req data mutably to reduce borrow check
|
// Inner is borrowed mut here and; get req data mutably to reduce borrow check. Also
|
||||||
|
// we know the req_data Rc will not have any cloned at this point to unwrap is okay.
|
||||||
Rc::get_mut(&mut inner.req_data).unwrap().get_mut().clear();
|
Rc::get_mut(&mut inner.req_data).unwrap().get_mut().clear();
|
||||||
|
|
||||||
// a re-borrow of pool is necessary here.
|
// a re-borrow of pool is necessary here.
|
||||||
|
|
Loading…
Reference in a new issue