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:
@@ -375,23 +375,12 @@ impl<T, B> fmt::Debug for Handshake<T, B>
|
||||
}
|
||||
}
|
||||
|
||||
impl proto::Peer for Peer {
|
||||
type Send = Response<()>;
|
||||
type Poll = Request<()>;
|
||||
|
||||
fn is_server() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn dyn() -> proto::DynPeer {
|
||||
proto::DynPeer::Server
|
||||
}
|
||||
|
||||
fn convert_send_message(
|
||||
impl Peer {
|
||||
pub fn convert_send_message(
|
||||
id: StreamId,
|
||||
response: Self::Send,
|
||||
end_of_stream: bool,
|
||||
) -> frame::Headers {
|
||||
response: Response<()>,
|
||||
end_of_stream: bool) -> frame::Headers
|
||||
{
|
||||
use http::response::Parts;
|
||||
|
||||
// Extract the components of the HTTP request
|
||||
@@ -417,6 +406,18 @@ impl proto::Peer for Peer {
|
||||
|
||||
frame
|
||||
}
|
||||
}
|
||||
|
||||
impl proto::Peer for Peer {
|
||||
type Poll = Request<()>;
|
||||
|
||||
fn is_server() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn dyn() -> proto::DynPeer {
|
||||
proto::DynPeer::Server
|
||||
}
|
||||
|
||||
fn convert_poll_message(headers: frame::Headers) -> Result<Self::Poll, RecvError> {
|
||||
use http::{uri, Version};
|
||||
|
||||
Reference in New Issue
Block a user