fix(cmd_line): correctly parse port when it is 443

This commit is contained in:
Σrebe - Romain GERARD 2024-12-15 09:27:47 +01:00
parent 36dc795d84
commit 38180e70f6
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4

View file

@ -459,11 +459,16 @@ fn parse_tunnel_dest(remaining: &str) -> Result<(Host<String>, u16, BTreeMap<Str
)); ));
}; };
let Some(remote_port) = remote.port_or_known_default() else { let remote_port = match remote.port() {
return Err(Error::new( Some(remote_port) => remote_port,
ErrorKind::InvalidInput, // the url lib does not parse the port if it is the default one
format!("cannot parse remote port from {}", remaining), None if remaining.ends_with(":443") => 443,
)); _ => {
return Err(Error::new(
ErrorKind::InvalidInput,
format!("cannot parse remote port from {}", remaining),
))
}
}; };
let options: BTreeMap<String, String> = remote.query_pairs().into_owned().collect(); let options: BTreeMap<String, String> = remote.query_pairs().into_owned().collect();