diff --git a/actix-http/src/h1/dispatcher.rs b/actix-http/src/h1/dispatcher.rs index 391e9d261..60552d102 100644 --- a/actix-http/src/h1/dispatcher.rs +++ b/actix-http/src/h1/dispatcher.rs @@ -23,7 +23,7 @@ use crate::error::{DispatchError, Error}; use crate::error::{ParseError, PayloadError}; use crate::request::Request; use crate::response::Response; -use crate::service::HttpServices; +use crate::service::HttpFlow; use crate::OnConnectData; use super::codec::Codec; @@ -91,7 +91,7 @@ where U: Service<(Request, Framed), Response = ()>, U::Error: fmt::Display, { - services: Rc>>, + services: Rc>>, on_connect_data: OnConnectData, flags: Flags, peer_addr: Option, @@ -177,7 +177,7 @@ where pub(crate) fn new( stream: T, config: ServiceConfig, - services: Rc>>, + services: Rc>>, on_connect_data: OnConnectData, peer_addr: Option, ) -> Self { @@ -200,7 +200,7 @@ where config: ServiceConfig, read_buf: BytesMut, timeout: Option, - services: Rc>>, + services: Rc>>, on_connect_data: OnConnectData, peer_addr: Option, ) -> Self { @@ -561,7 +561,7 @@ where req.head_mut().peer_addr = *this.peer_addr; // merge on_connect_ext data into request extensions - this.on_connect_data.merge(&mut req); + this.on_connect_data.merge_into(&mut req); if pl == MessageType::Stream && this.services.borrow().upgrade.is_some() @@ -1028,7 +1028,7 @@ mod tests { lazy(|cx| { let buf = TestBuffer::new("GET /test HTTP/1\r\n\r\n"); - let services = HttpServices::new(ok_service(), ExpectHandler, None); + let services = HttpFlow::new(ok_service(), ExpectHandler, None); let h1 = Dispatcher::<_, _, _, _, UpgradeHandler>::new( buf, @@ -1068,7 +1068,7 @@ mod tests { let cfg = ServiceConfig::new(KeepAlive::Disabled, 1, 1, false, None); - let services = HttpServices::new(echo_path_service(), ExpectHandler, None); + let services = HttpFlow::new(echo_path_service(), ExpectHandler, None); let h1 = Dispatcher::<_, _, _, _, UpgradeHandler>::new( buf, @@ -1122,7 +1122,7 @@ mod tests { let cfg = ServiceConfig::new(KeepAlive::Disabled, 1, 1, false, None); - let services = HttpServices::new(echo_path_service(), ExpectHandler, None); + let services = HttpFlow::new(echo_path_service(), ExpectHandler, None); let h1 = Dispatcher::<_, _, _, _, UpgradeHandler>::new( buf, @@ -1172,8 +1172,7 @@ mod tests { let mut buf = TestSeqBuffer::empty(); let cfg = ServiceConfig::new(KeepAlive::Disabled, 0, 0, false, None); - let services = - HttpServices::new(echo_payload_service(), ExpectHandler, None); + let services = HttpFlow::new(echo_payload_service(), ExpectHandler, None); let h1 = Dispatcher::<_, _, _, _, UpgradeHandler>::new( buf.clone(), @@ -1245,7 +1244,7 @@ mod tests { let mut buf = TestSeqBuffer::empty(); let cfg = ServiceConfig::new(KeepAlive::Disabled, 0, 0, false, None); - let services = HttpServices::new(echo_path_service(), ExpectHandler, None); + let services = HttpFlow::new(echo_path_service(), ExpectHandler, None); let h1 = Dispatcher::<_, _, _, _, UpgradeHandler>::new( buf.clone(), @@ -1306,7 +1305,7 @@ mod tests { let cfg = ServiceConfig::new(KeepAlive::Disabled, 0, 0, false, None); let services = - HttpServices::new(ok_service(), ExpectHandler, Some(UpgradeHandler)); + HttpFlow::new(ok_service(), ExpectHandler, Some(UpgradeHandler)); let h1 = Dispatcher::<_, _, _, _, UpgradeHandler>::new( buf.clone(), diff --git a/actix-http/src/h1/service.rs b/actix-http/src/h1/service.rs index 4dc681a97..19272c133 100644 --- a/actix-http/src/h1/service.rs +++ b/actix-http/src/h1/service.rs @@ -17,7 +17,7 @@ use crate::config::ServiceConfig; use crate::error::{DispatchError, Error}; use crate::request::Request; use crate::response::Response; -use crate::service::HttpServices; +use crate::service::HttpFlow; use crate::{ConnectCallback, OnConnectData}; use super::codec::Codec; @@ -367,7 +367,7 @@ where X: Service, U: Service<(Request, Framed)>, { - services: Rc>>, + services: Rc>>, on_connect_ext: Option>>, cfg: ServiceConfig, _phantom: PhantomData, @@ -392,7 +392,7 @@ where on_connect_ext: Option>>, ) -> H1ServiceHandler { H1ServiceHandler { - services: HttpServices::new(service, expect, upgrade), + services: HttpFlow::new(service, expect, upgrade), cfg, on_connect_ext, _phantom: PhantomData, diff --git a/actix-http/src/h2/dispatcher.rs b/actix-http/src/h2/dispatcher.rs index bcee4b75a..621035869 100644 --- a/actix-http/src/h2/dispatcher.rs +++ b/actix-http/src/h2/dispatcher.rs @@ -24,7 +24,7 @@ use crate::message::ResponseHead; use crate::payload::Payload; use crate::request::Request; use crate::response::Response; -use crate::service::HttpServices; +use crate::service::HttpFlow; use crate::OnConnectData; const CHUNK_SIZE: usize = 16_384; @@ -37,7 +37,7 @@ where S: Service, B: MessageBody, { - services: Rc>>, + services: Rc>>, connection: Connection, on_connect_data: OnConnectData, config: ServiceConfig, @@ -56,7 +56,7 @@ where B: MessageBody, { pub(crate) fn new( - services: Rc>>, + services: Rc>>, connection: Connection, on_connect_data: OnConnectData, config: ServiceConfig, @@ -134,7 +134,7 @@ where head.peer_addr = this.peer_addr; // merge on_connect_ext data into request extensions - this.on_connect_data.merge(&mut req); + this.on_connect_data.merge_into(&mut req); let svc = ServiceResponse:: { state: ServiceResponseState::ServiceCall( diff --git a/actix-http/src/h2/service.rs b/actix-http/src/h2/service.rs index 67a67b8d1..f94aae79e 100644 --- a/actix-http/src/h2/service.rs +++ b/actix-http/src/h2/service.rs @@ -22,7 +22,7 @@ use crate::config::ServiceConfig; use crate::error::{DispatchError, Error}; use crate::request::Request; use crate::response::Response; -use crate::service::HttpServices; +use crate::service::HttpFlow; use crate::{ConnectCallback, OnConnectData}; use super::dispatcher::Dispatcher; @@ -249,7 +249,7 @@ pub struct H2ServiceHandler where S: Service, { - services: Rc>>, + services: Rc>>, cfg: ServiceConfig, on_connect_ext: Option>>, _phantom: PhantomData, @@ -269,7 +269,7 @@ where service: S, ) -> H2ServiceHandler { H2ServiceHandler { - services: HttpServices::new(service, (), None), + services: HttpFlow::new(service, (), None), cfg, on_connect_ext, _phantom: PhantomData, @@ -325,7 +325,7 @@ where { Incoming(Dispatcher), Handshake( - Option>>>, + Option>>>, Option, Option, OnConnectData, diff --git a/actix-http/src/service.rs b/actix-http/src/service.rs index 82822053f..eb16a6e70 100644 --- a/actix-http/src/service.rs +++ b/actix-http/src/service.rs @@ -441,20 +441,20 @@ where X: Service, U: Service<(Request, Framed)>, { - services: Rc>>, + services: Rc>>, cfg: ServiceConfig, on_connect_ext: Option>>, _phantom: PhantomData, } // a collection of service for http. -pub(super) struct HttpServices { +pub(super) struct HttpFlow { pub(super) service: S, pub(super) expect: X, pub(super) upgrade: Option, } -impl HttpServices { +impl HttpFlow { pub(super) fn new(service: S, expect: X, upgrade: Option) -> Rc> { Rc::new(RefCell::new(Self { service, @@ -486,7 +486,7 @@ where HttpServiceHandler { cfg, on_connect_ext, - services: HttpServices::new(service, expect, upgrade), + services: HttpFlow::new(service, expect, upgrade), _phantom: PhantomData, } } @@ -603,7 +603,7 @@ where Option<( Handshake, ServiceConfig, - Rc>>, + Rc>>, OnConnectData, Option, )>,