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()))
|
||||
.unwrap_or_else(Bytes::new);
|
||||
|
||||
if path.is_empty() && method != Method::OPTIONS {
|
||||
match method {
|
||||
Method::OPTIONS | Method::CONNECT => {}
|
||||
_ if path.is_empty() => {
|
||||
path = Bytes::from_static(b"/");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let mut pseudo = Pseudo {
|
||||
method: Some(method),
|
||||
scheme: 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,
|
||||
};
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ async fn serve_connect() {
|
||||
let settings = client.assert_server_handshake().await;
|
||||
assert_default_settings!(settings);
|
||||
client
|
||||
.send_frame(frames::headers(1).method("CONNECT").eos())
|
||||
.send_frame(frames::headers(1).request("CONNECT", "localhost").eos())
|
||||
.await;
|
||||
client
|
||||
.recv_frame(frames::headers(1).response(200).eos())
|
||||
|
||||
Reference in New Issue
Block a user