feat(http): use the bytes crate for Chunk and internally

This commit is contained in:
Sean McArthur
2017-03-01 14:14:34 -08:00
parent cf7cc50ad0
commit 65b3e08f69
14 changed files with 306 additions and 598 deletions

View File

@@ -2,6 +2,8 @@
use std::borrow::Cow;
use std::fmt;
use bytes::BytesMut;
use header::{Connection, ConnectionOption};
use header::Headers;
use method::Method;
@@ -13,16 +15,15 @@ use version::HttpVersion::{Http10, Http11};
pub use self::conn::{Conn, KeepAlive, KA};
pub use self::body::{Body, TokioBody};
pub use self::chunk::Chunk;
use self::buf::MemBuf;
pub use self::str::ByteStr;
mod body;
#[doc(hidden)]
pub mod buf;
mod chunk;
mod conn;
mod io;
mod h1;
//mod h2;
mod str;
/*
macro_rules! nonblocking {
@@ -124,8 +125,7 @@ pub enum ClientTransaction {}
pub trait Http1Transaction {
type Incoming;
type Outgoing: Default;
//type KeepAlive: KeepAlive;
fn parse(bytes: &MemBuf) -> ParseResult<Self::Incoming>;
fn parse(bytes: &mut BytesMut) -> ParseResult<Self::Incoming>;
fn decoder(head: &MessageHead<Self::Incoming>) -> ::Result<h1::Decoder>;
fn encode(head: &mut MessageHead<Self::Outgoing>, dst: &mut Vec<u8>) -> h1::Encoder;
fn should_set_length(head: &MessageHead<Self::Outgoing>) -> bool;