mirror of
https://github.com/actix/actix-web.git
synced 2024-11-27 03:51:10 +00:00
use same payload type for h1 and h2
This commit is contained in:
parent
7d49a07f91
commit
5575ee7d2d
3 changed files with 7 additions and 4 deletions
|
@ -11,6 +11,7 @@ use log::error;
|
|||
use crate::body::MessageBody;
|
||||
use crate::config::{KeepAlive, ServiceConfig};
|
||||
use crate::error::{DispatchError, ParseError};
|
||||
use crate::payload::Payload;
|
||||
use crate::request::Request;
|
||||
use crate::response::Response;
|
||||
|
||||
|
@ -27,7 +28,7 @@ pub struct H1Service<T, S, B> {
|
|||
|
||||
impl<T, S, B> H1Service<T, S, B>
|
||||
where
|
||||
S: NewService<Request = Request, Response = Response<B>> + Clone,
|
||||
S: NewService<Request = Request<Payload>, Response = Response<B>> + Clone,
|
||||
S::Service: Clone,
|
||||
S::Error: Debug,
|
||||
B: MessageBody,
|
||||
|
|
|
@ -21,10 +21,11 @@ use crate::body::{Body, BodyLength, MessageBody, ResponseBody};
|
|||
use crate::config::ServiceConfig;
|
||||
use crate::error::{DispatchError, Error, ParseError, PayloadError, ResponseError};
|
||||
use crate::message::ResponseHead;
|
||||
use crate::payload::Payload;
|
||||
use crate::request::Request;
|
||||
use crate::response::Response;
|
||||
|
||||
use super::{H2ServiceResult, Payload};
|
||||
use super::H2ServiceResult;
|
||||
|
||||
const CHUNK_SIZE: usize = 16_384;
|
||||
|
||||
|
@ -113,7 +114,7 @@ where
|
|||
}
|
||||
|
||||
let (parts, body) = req.into_parts();
|
||||
let mut req = Request::with_payload(Payload::new(body));
|
||||
let mut req = Request::with_payload(body.into());
|
||||
|
||||
let head = &mut req.inner_mut().head;
|
||||
head.uri = parts.uri;
|
||||
|
|
|
@ -14,11 +14,12 @@ use log::error;
|
|||
use crate::body::MessageBody;
|
||||
use crate::config::{KeepAlive, ServiceConfig};
|
||||
use crate::error::{DispatchError, Error, ParseError, ResponseError};
|
||||
use crate::payload::Payload;
|
||||
use crate::request::Request;
|
||||
use crate::response::Response;
|
||||
|
||||
use super::dispatcher::Dispatcher;
|
||||
use super::{H2ServiceResult, Payload};
|
||||
use super::H2ServiceResult;
|
||||
|
||||
/// `NewService` implementation for HTTP2 transport
|
||||
pub struct H2Service<T, S, B> {
|
||||
|
|
Loading…
Reference in a new issue