@@ -606,7 +606,7 @@ async fn check_captive_portal(
606606 // length is limited; see is_challenge_char in bin/iroh-relay for more
607607 // details.
608608
609- let host_name = url. host_str ( ) . unwrap_or_default ( ) ;
609+ let host_name = url. host_str_without_final_dot ( ) . unwrap_or_default ( ) ;
610610 let challenge = format ! ( "ts_{host_name}" ) ;
611611 let portal_url = format ! ( "http://{host_name}/generate_204" ) ;
612612 let res = client
@@ -789,7 +789,9 @@ async fn run_https_probe(
789789 #[ cfg( any( test, feature = "test-utils" ) ) ] insecure_skip_relay_cert_verify : bool ,
790790) -> Result < HttpsProbeReport , MeasureHttpsLatencyError > {
791791 trace ! ( "HTTPS probe start" ) ;
792- let url = relay. join ( RELAY_PROBE_PATH ) ?;
792+ // Convert the relay URL to a URL that has no final dot, because the final dot
793+ // may trip up the certificate verification.
794+ let url = relay. without_final_dot ( ) . join ( RELAY_PROBE_PATH ) ?;
793795
794796 // This should also use same connection establishment as relay client itself, which
795797 // needs to be more configurable so users can do more crazy things:
@@ -802,7 +804,9 @@ async fn run_https_probe(
802804 }
803805
804806 #[ cfg( not( wasm_browser) ) ]
805- if let Some ( Host :: Domain ( domain) ) = url. host ( ) {
807+ if let ( Some ( Host :: Domain ( domain_for_dns) ) , Some ( Host :: Domain ( domain_for_reqwest) ) ) =
808+ ( relay. host ( ) , url. host ( ) )
809+ {
806810 // Use our own resolver rather than getaddrinfo
807811 //
808812 // Be careful, a non-zero port will override the port in the URI.
@@ -811,12 +815,12 @@ async fn run_https_probe(
811815 // but staggered for reliability. Ideally this tries to resolve **both** IPv4 and
812816 // IPv6 though. But our resolver does not have a function for that yet.
813817 let addrs: Vec < _ > = dns_resolver
814- . lookup_ipv4_ipv6_staggered ( domain , DNS_TIMEOUT , DNS_STAGGERING_MS )
818+ . lookup_ipv4_ipv6_staggered ( domain_for_dns , DNS_TIMEOUT , DNS_STAGGERING_MS )
815819 . await ?
816820 . map ( |ipaddr| SocketAddr :: new ( ipaddr, 0 ) )
817821 . collect ( ) ;
818822 trace ! ( ?addrs, "resolved addrs" ) ;
819- builder = builder. resolve_to_addrs ( domain , & addrs) ;
823+ builder = builder. resolve_to_addrs ( domain_for_reqwest , & addrs) ;
820824 }
821825
822826 #[ cfg( all( not( wasm_browser) , any( test, feature = "test-utils" ) ) ) ]
0 commit comments