Don't override empty path for CONNECT requests (#534)
This commit is contained in:
@@ -552,15 +552,19 @@ impl Pseudo {
|
|||||||
.map(|v| Bytes::copy_from_slice(v.as_str().as_bytes()))
|
.map(|v| Bytes::copy_from_slice(v.as_str().as_bytes()))
|
||||||
.unwrap_or_else(Bytes::new);
|
.unwrap_or_else(Bytes::new);
|
||||||
|
|
||||||
if path.is_empty() && method != Method::OPTIONS {
|
match method {
|
||||||
path = Bytes::from_static(b"/");
|
Method::OPTIONS | Method::CONNECT => {}
|
||||||
|
_ if path.is_empty() => {
|
||||||
|
path = Bytes::from_static(b"/");
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut pseudo = Pseudo {
|
let mut pseudo = Pseudo {
|
||||||
method: Some(method),
|
method: Some(method),
|
||||||
scheme: None,
|
scheme: None,
|
||||||
authority: None,
|
authority: None,
|
||||||
path: Some(unsafe { BytesStr::from_utf8_unchecked(path) }),
|
path: Some(unsafe { BytesStr::from_utf8_unchecked(path) }).filter(|p| !p.is_empty()),
|
||||||
status: None,
|
status: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ async fn serve_connect() {
|
|||||||
let settings = client.assert_server_handshake().await;
|
let settings = client.assert_server_handshake().await;
|
||||||
assert_default_settings!(settings);
|
assert_default_settings!(settings);
|
||||||
client
|
client
|
||||||
.send_frame(frames::headers(1).method("CONNECT").eos())
|
.send_frame(frames::headers(1).request("CONNECT", "localhost").eos())
|
||||||
.await;
|
.await;
|
||||||
client
|
client
|
||||||
.recv_frame(frames::headers(1).response(200).eos())
|
.recv_frame(frames::headers(1).response(200).eos())
|
||||||
|
|||||||
Reference in New Issue
Block a user