fix cannot use http_proxy connect non-standard http ports
This commit is contained in:
committed by
Martin Algesten
parent
2e7bcf255a
commit
ec663fad45
21
src/unit.rs
21
src/unit.rs
@@ -409,12 +409,21 @@ fn send_prelude(unit: &Unit, stream: &mut Stream) -> io::Result<()> {
|
|||||||
// HTTP proxies require the path to be in absolute URI form
|
// HTTP proxies require the path to be in absolute URI form
|
||||||
// https://www.rfc-editor.org/rfc/rfc7230#section-5.3.2
|
// https://www.rfc-editor.org/rfc/rfc7230#section-5.3.2
|
||||||
match proxy.proto {
|
match proxy.proto {
|
||||||
Proto::HTTP => format!(
|
Proto::HTTP => match unit.url.port() {
|
||||||
"{}://{}{}",
|
Some(port) => format!(
|
||||||
unit.url.scheme(),
|
"{}://{}:{}{}",
|
||||||
unit.url.host().unwrap(),
|
unit.url.scheme(),
|
||||||
unit.url.path()
|
unit.url.host().unwrap(),
|
||||||
),
|
port,
|
||||||
|
unit.url.path()
|
||||||
|
),
|
||||||
|
None => format!(
|
||||||
|
"{}://{}{}",
|
||||||
|
unit.url.scheme(),
|
||||||
|
unit.url.host().unwrap(),
|
||||||
|
unit.url.path()
|
||||||
|
),
|
||||||
|
},
|
||||||
_ => unit.url.path().into(),
|
_ => unit.url.path().into(),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user