diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index 2e8b93661..79d7117b4 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-http" -version = "0.2.10" +version = "0.2.9" authors = ["Nikolay Kim "] description = "Actix http primitives" readme = "README.md" diff --git a/actix-http/src/client/connection.rs b/actix-http/src/client/connection.rs index 5429f78de..21fc525b0 100644 --- a/actix-http/src/client/connection.rs +++ b/actix-http/src/client/connection.rs @@ -9,7 +9,7 @@ use h2::client::SendRequest; use crate::body::MessageBody; use crate::h1::ClientCodec; -use crate::message::{RequestHead, RequestHeadWrapper, ResponseHead}; +use crate::message::{RequestHead, RequestHeadType, ResponseHead}; use crate::payload::Payload; use crate::header::HeaderMap; @@ -129,14 +129,14 @@ where match self.io.take().unwrap() { ConnectionType::H1(io) => Box::new(h1proto::send_request( io, - RequestHeadWrapper::Owned(head), + RequestHeadType::Owned(head), body, self.created, self.pool, )), ConnectionType::H2(io) => Box::new(h2proto::send_request( io, - RequestHeadWrapper::Owned(head), + RequestHeadType::Owned(head), body, self.created, self.pool, @@ -153,14 +153,14 @@ where match self.io.take().unwrap() { ConnectionType::H1(io) => Box::new(h1proto::send_request( io, - RequestHeadWrapper::Rc(head, extra_headers), + RequestHeadType::Rc(head, extra_headers), body, self.created, self.pool, )), ConnectionType::H2(io) => Box::new(h2proto::send_request( io, - RequestHeadWrapper::Rc(head, extra_headers), + RequestHeadType::Rc(head, extra_headers), body, self.created, self.pool, @@ -182,7 +182,7 @@ where fn open_tunnel(mut self, head: RequestHead) -> Self::TunnelFuture { match self.io.take().unwrap() { ConnectionType::H1(io) => { - Either::A(Box::new(h1proto::open_tunnel(io, RequestHeadWrapper::Owned(head)))) + Either::A(Box::new(h1proto::open_tunnel(io, RequestHeadType::Owned(head)))) } ConnectionType::H2(io) => { if let Some(mut pool) = self.pool.take() { @@ -200,7 +200,7 @@ where fn open_tunnel_extra(mut self, head: Rc, extra_headers: Option) -> Self::TunnelFuture { match self.io.take().unwrap() { ConnectionType::H1(io) => { - Either::A(Box::new(h1proto::open_tunnel(io, RequestHeadWrapper::Rc(head, extra_headers)))) + Either::A(Box::new(h1proto::open_tunnel(io, RequestHeadType::Rc(head, extra_headers)))) } ConnectionType::H2(io) => { if let Some(mut pool) = self.pool.take() { diff --git a/actix-http/src/client/h1proto.rs b/actix-http/src/client/h1proto.rs index ac89d8f7d..dfe3e7902 100644 --- a/actix-http/src/client/h1proto.rs +++ b/actix-http/src/client/h1proto.rs @@ -9,7 +9,7 @@ use futures::{Async, Future, Poll, Sink, Stream}; use crate::error::PayloadError; use crate::h1; use crate::http::header::{IntoHeaderValue, HOST}; -use crate::message::{RequestHeadWrapper, ResponseHead}; +use crate::message::{RequestHeadType, ResponseHead}; use crate::payload::{Payload, PayloadStream}; use crate::header::HeaderMap; @@ -20,7 +20,7 @@ use crate::body::{BodySize, MessageBody}; pub(crate) fn send_request( io: T, - mut head_wrapper: RequestHeadWrapper, + mut head_wrapper: RequestHeadType, body: B, created: time::Instant, pool: Option>, @@ -42,10 +42,10 @@ where match wrt.get_mut().take().freeze().try_into() { Ok(value) => { match head_wrapper { - RequestHeadWrapper::Owned(ref mut head) => { + RequestHeadType::Owned(ref mut head) => { head.headers.insert(HOST, value) }, - RequestHeadWrapper::Rc(_, ref mut extra_headers) => { + RequestHeadType::Rc(_, ref mut extra_headers) => { let headers = extra_headers.get_or_insert(HeaderMap::new()); headers.insert(HOST, value) }, @@ -104,7 +104,7 @@ where pub(crate) fn open_tunnel( io: T, - head_wrapper: RequestHeadWrapper, + head_wrapper: RequestHeadType, ) -> impl Future), Error = SendRequestError> where T: AsyncRead + AsyncWrite + 'static, diff --git a/actix-http/src/client/h2proto.rs b/actix-http/src/client/h2proto.rs index bd34c6dca..2a5707019 100644 --- a/actix-http/src/client/h2proto.rs +++ b/actix-http/src/client/h2proto.rs @@ -9,7 +9,7 @@ use http::header::{HeaderValue, CONNECTION, CONTENT_LENGTH, TRANSFER_ENCODING}; use http::{request::Request, HttpTryFrom, Method, Version}; use crate::body::{BodySize, MessageBody}; -use crate::message::{RequestHeadWrapper, ResponseHead}; +use crate::message::{RequestHeadType, ResponseHead}; use crate::payload::Payload; use crate::header::HeaderMap; @@ -19,7 +19,7 @@ use super::pool::Acquired; pub(crate) fn send_request( io: SendRequest, - head_wrapper: RequestHeadWrapper, + head_wrapper: RequestHeadType, body: B, created: time::Instant, pool: Option>, @@ -69,8 +69,8 @@ where // Extracting extra headers from RequestHeadWrapper. HeaderMap::new() does not allocate. let (head_wrapper, extra_headers) = match head_wrapper { - RequestHeadWrapper::Owned(head) => (RequestHeadWrapper::Owned(head), HeaderMap::new()), - RequestHeadWrapper::Rc(head, extra_headers) => (RequestHeadWrapper::Rc(head, None), extra_headers.unwrap_or(HeaderMap::new())), + RequestHeadType::Owned(head) => (RequestHeadType::Owned(head), HeaderMap::new()), + RequestHeadType::Rc(head, extra_headers) => (RequestHeadType::Rc(head, None), extra_headers.unwrap_or(HeaderMap::new())), }; // merging headers from head and extra headers. diff --git a/actix-http/src/h1/client.rs b/actix-http/src/h1/client.rs index 4fefdf856..3c75a8692 100644 --- a/actix-http/src/h1/client.rs +++ b/actix-http/src/h1/client.rs @@ -17,7 +17,7 @@ use crate::body::BodySize; use crate::config::ServiceConfig; use crate::error::{ParseError, PayloadError}; use crate::helpers; -use crate::message::{ConnectionType, Head, MessagePool, RequestHead, RequestHeadWrapper, ResponseHead}; +use crate::message::{ConnectionType, Head, MessagePool, RequestHead, RequestHeadType, ResponseHead}; use crate::header::HeaderMap; bitflags! { @@ -50,7 +50,7 @@ struct ClientCodecInner { // encoder part flags: Flags, headers_size: u32, - encoder: encoder::MessageEncoder, + encoder: encoder::MessageEncoder, } impl Default for ClientCodec { @@ -185,7 +185,7 @@ impl Decoder for ClientPayloadCodec { } impl Encoder for ClientCodec { - type Item = Message<(RequestHeadWrapper, BodySize)>; + type Item = Message<(RequestHeadType, BodySize)>; type Error = io::Error; fn encode( diff --git a/actix-http/src/h1/encoder.rs b/actix-http/src/h1/encoder.rs index 6cfc5f92c..efae76f63 100644 --- a/actix-http/src/h1/encoder.rs +++ b/actix-http/src/h1/encoder.rs @@ -16,7 +16,7 @@ use crate::http::header::{ HeaderValue, ACCEPT_ENCODING, CONNECTION, CONTENT_LENGTH, DATE, TRANSFER_ENCODING, }; use crate::http::{HeaderMap, Method, StatusCode, Version}; -use crate::message::{ConnectionType, Head, RequestHead, ResponseHead, RequestHeadWrapper}; +use crate::message::{ConnectionType, Head, RequestHead, ResponseHead, RequestHeadType}; use crate::request::Request; use crate::response::Response; @@ -263,7 +263,7 @@ impl MessageType for Response<()> { } } -impl MessageType for RequestHeadWrapper { +impl MessageType for RequestHeadType { fn status(&self) -> Option { None } @@ -538,7 +538,7 @@ mod tests { head.headers .insert(CONTENT_TYPE, HeaderValue::from_static("plain/text")); - let mut head_wrapper = RequestHeadWrapper::Owned(head); + let mut head_wrapper = RequestHeadType::Owned(head); let _ = head_wrapper.encode_headers( &mut bytes, @@ -584,7 +584,7 @@ mod tests { head.headers .append(CONTENT_TYPE, HeaderValue::from_static("xml")); - let mut head_wrapper = RequestHeadWrapper::Owned(head); + let mut head_wrapper = RequestHeadType::Owned(head); let _ = head_wrapper.encode_headers( &mut bytes, @@ -610,7 +610,7 @@ mod tests { extra_headers.insert(AUTHORIZATION,HeaderValue::from_static("another authorization")); extra_headers.insert(DATE, HeaderValue::from_static("date")); - let mut head_wrapper = RequestHeadWrapper::Rc(Rc::new(head), Some(extra_headers)); + let mut head_wrapper = RequestHeadType::Rc(Rc::new(head), Some(extra_headers)); let _ = head_wrapper.encode_headers( &mut bytes, diff --git a/actix-http/src/message.rs b/actix-http/src/message.rs index bb8c87aef..cda700f7d 100644 --- a/actix-http/src/message.rs +++ b/actix-http/src/message.rs @@ -182,25 +182,25 @@ impl RequestHead { } #[derive(Debug)] -pub enum RequestHeadWrapper { +pub enum RequestHeadType { Owned(RequestHead), Rc(Rc, Option), } -impl RequestHeadWrapper { +impl RequestHeadType { pub fn extra_headers(&self) -> Option<&HeaderMap> { match self { - RequestHeadWrapper::Owned(_) => None, - RequestHeadWrapper::Rc(_, headers) => headers.as_ref(), + RequestHeadType::Owned(_) => None, + RequestHeadType::Rc(_, headers) => headers.as_ref(), } } } -impl AsRef for RequestHeadWrapper { +impl AsRef for RequestHeadType { fn as_ref(&self) -> &RequestHead { match self { - RequestHeadWrapper::Owned(head) => &head, - RequestHeadWrapper::Rc(head, _) => head.as_ref(), + RequestHeadType::Owned(head) => &head, + RequestHeadType::Rc(head, _) => head.as_ref(), } } } diff --git a/awc/Cargo.toml b/awc/Cargo.toml index 72374434e..7f42501e9 100644 --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "awc" -version = "0.2.5" +version = "0.2.4" authors = ["Nikolay Kim "] description = "Actix http client." readme = "README.md"