Skip to content

Commit 8977dc4

Browse files
committed
fix: command line parsing for remote port 443 with options
1 parent a28c7e8 commit 8977dc4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/config.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ mod parsers {
482482
let remote_port = match remote.port() {
483483
Some(remote_port) => remote_port,
484484
// the url lib does not parse the port if it is the default one
485-
None if remaining.ends_with(":443") => 443,
485+
None if remaining.ends_with(":443") || remaining.contains(":443?") => 443,
486486
_ => {
487487
return Err(Error::new(
488488
ErrorKind::InvalidInput,
@@ -736,6 +736,7 @@ mod parsers {
736736
use url::Host;
737737

738738
#[test_case("localhost:443" => (Host::Domain("localhost".to_string()), 443, BTreeMap::new()) ; "with domain")]
739+
#[test_case("localhost:443?timeout_sec=0" => (Host::Domain("localhost".to_string()), 443, btreemap! { "timeout_sec".to_string() => "0".to_string() } ) ; "with domain and options")]
739740
#[test_case("127.0.0.1:443" => (Host::Ipv4(Ipv4Addr::new(127, 0, 0, 1)), 443, BTreeMap::new()) ; "with IPv4")]
740741
#[test_case("[::1]:8080" => (Host::Ipv6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8080, BTreeMap::new()) ; "with IpV6")]
741742
#[test_case("a:1?timeout_sec=30&b=5" => (Host::Domain("a".to_string()), 1, btreemap! { "b".to_string() => "5".to_string(), "timeout_sec".to_string() => "30".to_string() }) ; "with options")]

0 commit comments

Comments
 (0)