Skip to content

Commit 38180e7

Browse files
committed
fix(cmd_line): correctly parse port when it is 443
1 parent 36dc795 commit 38180e7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/main.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,16 @@ fn parse_tunnel_dest(remaining: &str) -> Result<(Host<String>, u16, BTreeMap<Str
459459
));
460460
};
461461

462-
let Some(remote_port) = remote.port_or_known_default() else {
463-
return Err(Error::new(
464-
ErrorKind::InvalidInput,
465-
format!("cannot parse remote port from {}", remaining),
466-
));
462+
let remote_port = match remote.port() {
463+
Some(remote_port) => remote_port,
464+
// the url lib does not parse the port if it is the default one
465+
None if remaining.ends_with(":443") => 443,
466+
_ => {
467+
return Err(Error::new(
468+
ErrorKind::InvalidInput,
469+
format!("cannot parse remote port from {}", remaining),
470+
))
471+
}
467472
};
468473

469474
let options: BTreeMap<String, String> = remote.query_pairs().into_owned().collect();

0 commit comments

Comments
 (0)