Expose Codec via an unstable flag (#49)
Exposes `Codec` using an unstable flag. This is useful for testing.
This commit is contained in:
@@ -13,8 +13,11 @@ matrix:
|
|||||||
- travis-cargo doc-upload
|
- travis-cargo doc-upload
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
# Run tests
|
||||||
- cargo test
|
- cargo test
|
||||||
|
# Test examples in readme
|
||||||
- rustdoc --test README.md -L target/debug/deps
|
- rustdoc --test README.md -L target/debug/deps
|
||||||
|
# Generate docs
|
||||||
- cargo doc --no-deps
|
- cargo doc --no-deps
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|||||||
19
Cargo.toml
19
Cargo.toml
@@ -3,6 +3,16 @@ name = "h2"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Carl Lerche <me@carllerche.com>"]
|
authors = ["Carl Lerche <me@carllerche.com>"]
|
||||||
|
|
||||||
|
[features]
|
||||||
|
|
||||||
|
# Enables **unstable** APIs. Any API exposed by this feature has no backwards
|
||||||
|
# compatibility guarantees. In other words, you should not use this feature for
|
||||||
|
# anything besides experimentation. Definitely **do not** publish a crate that
|
||||||
|
# depends on this feature.
|
||||||
|
unstable = []
|
||||||
|
|
||||||
|
[workspace]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
tokio-io = "0.1.3"
|
tokio-io = "0.1.3"
|
||||||
@@ -16,7 +26,14 @@ slab = "0.4.0"
|
|||||||
string = { git = "https://github.com/carllerche/string" }
|
string = { git = "https://github.com/carllerche/string" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
mock-io = { git = "https://github.com/carllerche/mock-io", branch = "experiments" }
|
|
||||||
|
# Support code for tests. Ideally this wouldn't be released to crates.io, but
|
||||||
|
# until rust-lang/cargo#4466 is resolved, we just have to publish this junk crate.
|
||||||
|
#
|
||||||
|
# The dependency is set on a fixed version as the `h2-test-support` offers no
|
||||||
|
# guarantees of backwards compatibility across minor versions. The version of
|
||||||
|
# `h2-test-support` should always match the current version of `h2`.
|
||||||
|
h2-test-support = { version = "= 0.1.0", path = "tests/support" }
|
||||||
|
|
||||||
# Fuzzing
|
# Fuzzing
|
||||||
quickcheck = "0.4.1"
|
quickcheck = "0.4.1"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ extern crate h2;
|
|||||||
extern crate http;
|
extern crate http;
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
extern crate rustls;
|
extern crate rustls;
|
||||||
extern crate tokio_io;
|
|
||||||
extern crate tokio_core;
|
extern crate tokio_core;
|
||||||
extern crate tokio_rustls;
|
extern crate tokio_rustls;
|
||||||
extern crate webpki_roots;
|
extern crate webpki_roots;
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ extern crate h2;
|
|||||||
extern crate http;
|
extern crate http;
|
||||||
extern crate bytes;
|
extern crate bytes;
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
extern crate tokio_io;
|
|
||||||
extern crate tokio_core;
|
extern crate tokio_core;
|
||||||
extern crate io_dump;
|
extern crate io_dump;
|
||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
|
|
||||||
use h2::*;
|
|
||||||
use h2::client::{Client, Body};
|
use h2::client::{Client, Body};
|
||||||
|
|
||||||
use http::*;
|
use http::*;
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ extern crate h2;
|
|||||||
extern crate http;
|
extern crate http;
|
||||||
extern crate bytes;
|
extern crate bytes;
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
extern crate tokio_io;
|
|
||||||
extern crate tokio_core;
|
extern crate tokio_core;
|
||||||
extern crate io_dump;
|
|
||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
|
|
||||||
use h2::server::Server;
|
use h2::server::Server;
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ extern crate h2;
|
|||||||
extern crate http;
|
extern crate http;
|
||||||
extern crate bytes;
|
extern crate bytes;
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
extern crate tokio_io;
|
|
||||||
extern crate tokio_core;
|
extern crate tokio_core;
|
||||||
extern crate io_dump;
|
|
||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
|
|
||||||
use h2::server::Server;
|
use h2::server::Server;
|
||||||
|
|||||||
@@ -258,3 +258,14 @@ impl<T: AsyncRead, B> AsyncRead for FramedWrite<T, B> {
|
|||||||
self.inner.prepare_uninitialized_buffer(buf)
|
self.inner.prepare_uninitialized_buffer(buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "unstable")]
|
||||||
|
mod unstable {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
impl<T, B> FramedWrite<T, B> {
|
||||||
|
pub fn get_ref(&self) -> &T {
|
||||||
|
&self.inner
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ impl<T, B> Codec<T, B> {
|
|||||||
self.inner.get_ref().max_frame_size()
|
self.inner.get_ref().max_frame_size()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "unstable")]
|
||||||
|
pub fn get_ref(&self) -> &T {
|
||||||
|
self.inner.get_ref().get_ref()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_mut(&mut self) -> &mut T {
|
pub fn get_mut(&mut self) -> &mut T {
|
||||||
self.inner.get_mut().get_mut()
|
self.inner.get_mut().get_mut()
|
||||||
}
|
}
|
||||||
@@ -146,3 +151,12 @@ impl<T, B> Sink for Codec<T, B>
|
|||||||
Ok(Async::Ready(()))
|
Ok(Async::Ready(()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove (or improve) this
|
||||||
|
impl<T> From<T> for Codec<T, ::std::io::Cursor<::bytes::Bytes>>
|
||||||
|
where T: AsyncRead + AsyncWrite,
|
||||||
|
{
|
||||||
|
fn from(src: T) -> Self {
|
||||||
|
Self::new(src)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use bytes::{BufMut, Bytes, Buf};
|
|||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
#[derive(Eq, PartialEq)]
|
||||||
pub struct Data<T = Bytes> {
|
pub struct Data<T = Bytes> {
|
||||||
stream_id: StreamId,
|
stream_id: StreamId,
|
||||||
data: T,
|
data: T,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use frame::{self, Head, Error, Kind, StreamId, Reason};
|
|||||||
|
|
||||||
use bytes::{BufMut, BigEndian};
|
use bytes::{BufMut, BigEndian};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
||||||
pub struct GoAway {
|
pub struct GoAway {
|
||||||
last_stream_id: StreamId,
|
last_stream_id: StreamId,
|
||||||
error_code: u32,
|
error_code: u32,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use std::io::Cursor;
|
|||||||
/// Header frame
|
/// Header frame
|
||||||
///
|
///
|
||||||
/// This could be either a request or a response.
|
/// This could be either a request or a response.
|
||||||
|
#[derive(Eq, PartialEq)]
|
||||||
pub struct Headers {
|
pub struct Headers {
|
||||||
/// The ID of the stream with which this frame is associated.
|
/// The ID of the stream with which this frame is associated.
|
||||||
stream_id: StreamId,
|
stream_id: StreamId,
|
||||||
@@ -36,7 +37,7 @@ pub struct Headers {
|
|||||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||||
pub struct HeadersFlag(u8);
|
pub struct HeadersFlag(u8);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
pub struct PushPromise {
|
pub struct PushPromise {
|
||||||
/// The ID of the stream with which this frame is associated.
|
/// The ID of the stream with which this frame is associated.
|
||||||
stream_id: StreamId,
|
stream_id: StreamId,
|
||||||
@@ -63,7 +64,7 @@ pub struct Continuation {
|
|||||||
headers: Iter,
|
headers: Iter,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Eq, PartialEq)]
|
||||||
pub struct Pseudo {
|
pub struct Pseudo {
|
||||||
// Request
|
// Request
|
||||||
pub method: Option<Method>,
|
pub method: Option<Method>,
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ pub type FrameSize = u32;
|
|||||||
|
|
||||||
pub const HEADER_LEN: usize = 9;
|
pub const HEADER_LEN: usize = 9;
|
||||||
|
|
||||||
|
#[derive(Eq, PartialEq)]
|
||||||
pub enum Frame<T = Bytes> {
|
pub enum Frame<T = Bytes> {
|
||||||
Data(Data<T>),
|
Data(Data<T>),
|
||||||
Headers(Headers),
|
Headers(Headers),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const ACK_FLAG: u8 = 0x1;
|
|||||||
|
|
||||||
pub type Payload = [u8; 8];
|
pub type Payload = [u8; 8];
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
pub struct Ping {
|
pub struct Ping {
|
||||||
ack: bool,
|
ack: bool,
|
||||||
payload: Payload,
|
payload: Payload,
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
use frame::*;
|
use frame::*;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
pub struct Priority {
|
pub struct Priority {
|
||||||
stream_id: StreamId,
|
stream_id: StreamId,
|
||||||
dependency: StreamDependency,
|
dependency: StreamDependency,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
pub struct StreamDependency {
|
pub struct StreamDependency {
|
||||||
/// The ID of the stream dependency target
|
/// The ID of the stream dependency target
|
||||||
dependency_id: StreamId,
|
dependency_id: StreamId,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use frame::{self, Head, Error, Kind, StreamId, Reason};
|
|||||||
|
|
||||||
use bytes::{BufMut, BigEndian};
|
use bytes::{BufMut, BigEndian};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
pub struct Reset {
|
pub struct Reset {
|
||||||
stream_id: StreamId,
|
stream_id: StreamId,
|
||||||
error_code: u32,
|
error_code: u32,
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ pub fn strip_padding(payload: &mut Bytes) -> Result<u8, Error> {
|
|||||||
return Err(Error::TooMuchPadding);
|
return Err(Error::TooMuchPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = payload.split_off(pad_len);
|
|
||||||
let _ = payload.split_to(1);
|
let _ = payload.split_to(1);
|
||||||
|
let _ = payload.split_off(pad_len);
|
||||||
|
|
||||||
Ok(pad_len as u8)
|
Ok(pad_len as u8)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use bytes::{BufMut, BigEndian};
|
|||||||
|
|
||||||
const SIZE_INCREMENT_MASK: u32 = 1 << 31;
|
const SIZE_INCREMENT_MASK: u32 = 1 << 31;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||||
pub struct WindowUpdate {
|
pub struct WindowUpdate {
|
||||||
stream_id: StreamId,
|
stream_id: StreamId,
|
||||||
size_increment: u32,
|
size_increment: u32,
|
||||||
|
|||||||
10
src/lib.rs
10
src/lib.rs
@@ -1,4 +1,4 @@
|
|||||||
// #![deny(warnings, missing_debug_implementations)]
|
#![deny(warnings, missing_debug_implementations)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
@@ -28,9 +28,17 @@ mod error;
|
|||||||
mod codec;
|
mod codec;
|
||||||
mod hpack;
|
mod hpack;
|
||||||
mod proto;
|
mod proto;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable"))]
|
||||||
mod frame;
|
mod frame;
|
||||||
|
|
||||||
|
#[cfg(feature = "unstable")]
|
||||||
|
pub mod frame;
|
||||||
|
|
||||||
pub mod client;
|
pub mod client;
|
||||||
pub mod server;
|
pub mod server;
|
||||||
|
|
||||||
pub use error::{Error, Reason};
|
pub use error::{Error, Reason};
|
||||||
|
|
||||||
|
#[cfg(feature = "unstable")]
|
||||||
|
pub use codec::{Codec, SendError, RecvError, UserError};
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
#[macro_use]
|
extern crate h2_test_support;
|
||||||
pub mod support;
|
use h2_test_support::*;
|
||||||
use support::*;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn handshake() {
|
fn handshake() {
|
||||||
|
|||||||
48
tests/codec_read.rs
Normal file
48
tests/codec_read.rs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#[macro_use]
|
||||||
|
extern crate h2_test_support;
|
||||||
|
use h2_test_support::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn read_none() {
|
||||||
|
let mut codec = Codec::from(
|
||||||
|
mock_io::Builder::new()
|
||||||
|
.build());
|
||||||
|
|
||||||
|
assert_closed!(codec);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn read_data_no_padding() {
|
||||||
|
let mut codec = raw_codec! {
|
||||||
|
read => [
|
||||||
|
0, 0, 5, 0, 0, 0, 0, 0, 1,
|
||||||
|
"hello",
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
let data = poll_data!(codec);
|
||||||
|
assert_eq!(data.stream_id(), 1);
|
||||||
|
assert_eq!(data.payload(), &b"hello"[..]);
|
||||||
|
assert!(!data.is_end_stream());
|
||||||
|
|
||||||
|
assert_closed!(codec);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn read_data_padding() {
|
||||||
|
let mut codec = raw_codec! {
|
||||||
|
read => [
|
||||||
|
0, 0, 11, 0, 0x8, 0, 0, 0, 1,
|
||||||
|
5, // Pad length
|
||||||
|
"hello", // Data
|
||||||
|
"world", // Padding
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
let data = poll_data!(codec);
|
||||||
|
assert_eq!(data.stream_id(), 1);
|
||||||
|
assert_eq!(data.payload(), &b"hello"[..]);
|
||||||
|
assert!(!data.is_end_stream());
|
||||||
|
|
||||||
|
assert_closed!(codec);
|
||||||
|
}
|
||||||
0
tests/codec_write.rs
Normal file
0
tests/codec_write.rs
Normal file
@@ -1,5 +1,5 @@
|
|||||||
pub mod support;
|
extern crate h2_test_support;
|
||||||
use support::*;
|
use h2_test_support::*;
|
||||||
|
|
||||||
// In this case, the stream & connection both have capacity, but capacity is not
|
// In this case, the stream & connection both have capacity, but capacity is not
|
||||||
// explicitly requested.
|
// explicitly requested.
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
pub mod support;
|
/*
|
||||||
use support::*;
|
extern crate h2_test_support;
|
||||||
|
use h2_test_support::*;
|
||||||
|
*/
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
pub mod support;
|
extern crate h2_test_support;
|
||||||
use support::*;
|
use h2_test_support::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn single_stream_send_large_body() {
|
fn single_stream_send_large_body() {
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
extern crate h2;
|
extern crate h2_test_support;
|
||||||
extern crate http;
|
use h2_test_support::*;
|
||||||
extern crate futures;
|
|
||||||
extern crate mock_io;
|
|
||||||
extern crate env_logger;
|
|
||||||
|
|
||||||
use h2::server::Server;
|
|
||||||
|
|
||||||
use futures::*;
|
|
||||||
|
|
||||||
const SETTINGS: &'static [u8] = &[0, 0, 0, 4, 0, 0, 0, 0, 0];
|
const SETTINGS: &'static [u8] = &[0, 0, 0, 4, 0, 0, 0, 0, 0];
|
||||||
const SETTINGS_ACK: &'static [u8] = &[0, 0, 0, 4, 1, 0, 0, 0, 0];
|
const SETTINGS_ACK: &'static [u8] = &[0, 0, 0, 4, 1, 0, 0, 0, 0];
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
#[macro_use]
|
extern crate h2_test_support;
|
||||||
pub mod support;
|
use h2_test_support::*;
|
||||||
use support::*;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn send_recv_headers_only() {
|
fn send_recv_headers_only() {
|
||||||
|
|||||||
17
tests/support/Cargo.toml
Normal file
17
tests/support/Cargo.toml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
[package]
|
||||||
|
name = "h2-test-support"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Carl Lerche <me@carllerche.com>"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
futures = "0.1"
|
||||||
|
tokio-io = "0.1"
|
||||||
|
bytes = "0.4"
|
||||||
|
http = { git = "https://github.com/carllerche/http", rev = "2dd15d9" }
|
||||||
|
env_logger = "0.4"
|
||||||
|
|
||||||
|
mock-io = { git = "https://github.com/carllerche/mock-io", branch = "experiments" }
|
||||||
|
|
||||||
|
[dependencies.h2]
|
||||||
|
path = "../.."
|
||||||
|
features = ["unstable"]
|
||||||
3
tests/support/README.md
Normal file
3
tests/support/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
**This is not a real crate**
|
||||||
|
|
||||||
|
You should not use this crate, it only exists to work around cargo limitations.
|
||||||
64
tests/support/src/codec.rs
Normal file
64
tests/support/src/codec.rs
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#[macro_export]
|
||||||
|
macro_rules! assert_closed {
|
||||||
|
($transport:expr) => {{
|
||||||
|
assert_eq!($transport.poll().unwrap(), None.into());
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! poll_data {
|
||||||
|
($transport:expr) => {{
|
||||||
|
use h2::frame::Frame;
|
||||||
|
use futures::Async;
|
||||||
|
|
||||||
|
match $transport.poll() {
|
||||||
|
Ok(Async::Ready(Some(Frame::Data(frame)))) => frame,
|
||||||
|
frame => panic!("expected data frame; actual={:?}", frame),
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! raw_codec {
|
||||||
|
(
|
||||||
|
$(
|
||||||
|
$fn:ident => [$($chunk:expr,)+];
|
||||||
|
)*
|
||||||
|
) => {{
|
||||||
|
let mut b = $crate::mock_io::Builder::new();
|
||||||
|
|
||||||
|
$({
|
||||||
|
let mut chunk = vec![];
|
||||||
|
|
||||||
|
$(
|
||||||
|
$crate::codec::Chunk::push(&$chunk, &mut chunk);
|
||||||
|
)+
|
||||||
|
|
||||||
|
b.$fn(&chunk[..]);
|
||||||
|
})*
|
||||||
|
|
||||||
|
$crate::Codec::new(b.build())
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait Chunk {
|
||||||
|
fn push(&self, dst: &mut Vec<u8>);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Chunk for u8 {
|
||||||
|
fn push(&self, dst: &mut Vec<u8>) {
|
||||||
|
dst.push(*self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Chunk for &'a [u8] {
|
||||||
|
fn push(&self, dst: &mut Vec<u8>) {
|
||||||
|
dst.extend(*self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Chunk for &'a str {
|
||||||
|
fn push(&self, dst: &mut Vec<u8>) {
|
||||||
|
dst.extend(self.as_bytes())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
//! Utilities to support tests.
|
//! Utilities to support tests.
|
||||||
|
|
||||||
#![allow(unused_extern_crates)]
|
|
||||||
|
|
||||||
pub extern crate bytes;
|
pub extern crate bytes;
|
||||||
pub extern crate h2;
|
pub extern crate h2;
|
||||||
pub extern crate http;
|
pub extern crate http;
|
||||||
@@ -10,6 +8,9 @@ pub extern crate futures;
|
|||||||
pub extern crate mock_io;
|
pub extern crate mock_io;
|
||||||
pub extern crate env_logger;
|
pub extern crate env_logger;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
pub mod codec;
|
||||||
|
|
||||||
pub use self::futures::{
|
pub use self::futures::{
|
||||||
Future,
|
Future,
|
||||||
Sink,
|
Sink,
|
||||||
@@ -27,8 +28,11 @@ pub use self::http::{
|
|||||||
HeaderMap,
|
HeaderMap,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub use self::h2::*;
|
||||||
pub use self::h2::client::{self, Client};
|
pub use self::h2::client::{self, Client};
|
||||||
// pub use self::h2::server;
|
pub use self::h2::server::{self, Server};
|
||||||
|
|
||||||
|
pub type Codec<T> = h2::Codec<T, ::std::io::Cursor<::bytes::Bytes>>;
|
||||||
|
|
||||||
pub use self::bytes::{
|
pub use self::bytes::{
|
||||||
Buf,
|
Buf,
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
#[macro_use]
|
extern crate h2_test_support;
|
||||||
pub mod support;
|
use h2_test_support::*;
|
||||||
use support::*;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn recv_trailers_only() {
|
fn recv_trailers_only() {
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "h2-codec"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["Carl Lerche <me@carllerche.com>"]
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
http = { git = "https://github.com/carllerche/http" }
|
|
||||||
log = "0.3.8"
|
|
||||||
fnv = "1.0.5"
|
|
||||||
bytes = "0.4"
|
|
||||||
string = { git = "https://github.com/carllerche/string" }
|
|
||||||
byteorder = "1.0"
|
|
||||||
futures = "0.1"
|
|
||||||
tokio-io = "0.1.3"
|
|
||||||
|
|
||||||
# tokio-timer = "0.1"
|
|
||||||
# http = { git = "https://github.com/carllerche/http", branch = "lower-case-header-name-parsing" }
|
|
||||||
# slab = "0.4.0"
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
extern crate http;
|
|
||||||
extern crate fnv;
|
|
||||||
extern crate bytes;
|
|
||||||
extern crate string;
|
|
||||||
extern crate byteorder;
|
|
||||||
|
|
||||||
extern crate futures;
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate tokio_io;
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate log;
|
|
||||||
|
|
||||||
#[path = "../../../src/hpack/mod.rs"]
|
|
||||||
mod hpack;
|
|
||||||
|
|
||||||
#[path = "../../../src/frame/mod.rs"]
|
|
||||||
mod frame;
|
|
||||||
|
|
||||||
#[path = "../../../src/codec/mod.rs"]
|
|
||||||
mod codec;
|
|
||||||
Reference in New Issue
Block a user