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 07d7e15485
commit f47b562905

View file

@ -119,7 +119,7 @@ impl super::Service {
async fn actual_dest_2(&self, dest: &ServerName, cache: bool, pos: usize) -> Result<FedDest> { async fn actual_dest_2(&self, dest: &ServerName, cache: bool, pos: usize) -> Result<FedDest> {
debug!("2: Hostname with included port"); debug!("2: Hostname with included port");
let (host, port) = dest.as_str().split_at(pos); 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?; .await?;
Ok(FedDest::Named( Ok(FedDest::Named(
@ -165,7 +165,7 @@ impl super::Service {
) -> Result<FedDest> { ) -> Result<FedDest> {
debug!("3.2: Hostname with port in .well-known file"); debug!("3.2: Hostname with port in .well-known file");
let (host, port) = delegated.split_at(pos); 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?; .await?;
Ok(FedDest::Named( Ok(FedDest::Named(