1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-09-17 00:50:01 +00:00

use same payload type for h1 and h2

This commit is contained in:
Nikolay Kim 2019-02-07 13:41:50 -08:00
parent 7d49a07f91
commit 5575ee7d2d
3 changed files with 7 additions and 4 deletions

View file

@ -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,

View file

@ -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;

View file

@ -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> {