reset streams when receiving invalid psuedo headers
This commit is contained in:
@@ -136,6 +136,12 @@ impl Mock<frame::Headers> {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Mock<frame::Headers>> for frame::Headers {
|
||||
fn from(src: Mock<frame::Headers>) -> Self {
|
||||
src.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Mock<frame::Headers>> for SendFrame {
|
||||
fn from(src: Mock<frame::Headers>) -> Self {
|
||||
Frame::Headers(src.0)
|
||||
@@ -234,6 +240,11 @@ impl From<Mock<frame::GoAway>> for SendFrame {
|
||||
// ==== Reset helpers
|
||||
|
||||
impl Mock<frame::Reset> {
|
||||
pub fn protocol_error(self) -> Self {
|
||||
let id = self.0.stream_id();
|
||||
Mock(frame::Reset::new(id, frame::Reason::ProtocolError))
|
||||
}
|
||||
|
||||
pub fn flow_control(self) -> Self {
|
||||
let id = self.0.stream_id();
|
||||
Mock(frame::Reset::new(id, frame::Reason::FlowControlError))
|
||||
|
||||
@@ -12,6 +12,7 @@ pub extern crate futures;
|
||||
pub extern crate h2;
|
||||
pub extern crate http;
|
||||
pub extern crate mock_io;
|
||||
pub extern crate string;
|
||||
pub extern crate tokio_io;
|
||||
|
||||
// Kind of annoying, but we can't use macros from crates that aren't specified
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
use h2::client;
|
||||
|
||||
use super::string::{String, TryFrom};
|
||||
use bytes::Bytes;
|
||||
use futures::{Async, Future, Poll};
|
||||
|
||||
pub fn byte_str(s: &str) -> String<Bytes> {
|
||||
String::try_from(Bytes::from(s)).unwrap()
|
||||
}
|
||||
|
||||
pub fn wait_for_capacity(stream: client::Stream<Bytes>, target: usize) -> WaitForCapacity {
|
||||
WaitForCapacity {
|
||||
stream: Some(stream),
|
||||
|
||||
Reference in New Issue
Block a user