fix(resolver): port parser does not handle leading ':'

conditionally trim the leading colon
This commit is contained in:
Joe Citrine
2026-02-17 23:34:15 +00:00
committed by Jacob Taylor
parent 6ca96742fa
commit 47152f854c

View File

@@ -119,7 +119,7 @@ fn actual_dest_1(host_port: FedDest) -> Result<FedDest> {
async fn actual_dest_2(&self, dest: &ServerName, cache: bool, pos: usize) -> Result<FedDest> {
debug!("2: Hostname with included port");
let (host, port) = dest.as_str().split_at(pos);
self.conditional_query_and_cache(host, port.parse::<u16>().unwrap_or(8448), cache)
self.conditional_query_and_cache(host, port.trim_start_matches(':').parse::<u16>().unwrap_or(8448), cache)
.await?;
Ok(FedDest::Named(
@@ -165,7 +165,7 @@ async fn actual_dest_3_2(
) -> Result<FedDest> {
debug!("3.2: Hostname with port in .well-known file");
let (host, port) = delegated.split_at(pos);
self.conditional_query_and_cache(host, port.parse::<u16>().unwrap_or(8448), cache)
self.conditional_query_and_cache(host, port.trim_start_matches(':').parse::<u16>().unwrap_or(8448), cache)
.await?;
Ok(FedDest::Named(