Client should validate request URI. (#181)
This patch adds checks for the request URI and rejects invalid URIs. In the case of forwarding an HTTP 1.1 request with a path, an "http" pseudo header is added to satisfy the HTTP/2.0 spec. Closes #179
This commit is contained in:
@@ -137,6 +137,16 @@ impl Mock<frame::Headers> {
|
||||
Mock(frame)
|
||||
}
|
||||
|
||||
pub fn scheme(self, value: &str) -> Self
|
||||
{
|
||||
let (id, mut pseudo, fields) = self.into_parts();
|
||||
let value = value.parse().unwrap();
|
||||
|
||||
pseudo.set_scheme(value);
|
||||
|
||||
Mock(frame::Headers::new(id, pseudo, fields))
|
||||
}
|
||||
|
||||
pub fn eos(mut self) -> Self {
|
||||
self.0.set_end_stream();
|
||||
self
|
||||
|
||||
@@ -32,7 +32,7 @@ pub use self::futures::{Future, IntoFuture, Sink, Stream};
|
||||
pub use super::future_ext::{FutureExt, Unwrap};
|
||||
|
||||
// Re-export HTTP types
|
||||
pub use self::http::{HeaderMap, Method, Request, Response, StatusCode};
|
||||
pub use self::http::{HeaderMap, Method, Request, Response, StatusCode, Version};
|
||||
|
||||
pub use self::bytes::{Buf, BufMut, Bytes, BytesMut, IntoBuf};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user