mirror of
https://github.com/openharmony/third_party_rust_hyper.git
synced 2026-07-18 19:04:27 -04:00
fix(client): remove ipv6 square brackets before resolving
This commit is contained in:
committed by
Sean McArthur
parent
189561264c
commit
3f977b5029
@@ -191,7 +191,6 @@ impl SocketAddrs {
|
||||
iter: vec![SocketAddr::V4(addr)].into_iter(),
|
||||
});
|
||||
}
|
||||
let host = host.trim_start_matches('[').trim_end_matches(']');
|
||||
if let Ok(addr) = host.parse::<Ipv6Addr>() {
|
||||
let addr = SocketAddrV6::new(addr, port, 0, 0);
|
||||
return Some(SocketAddrs {
|
||||
|
||||
@@ -326,6 +326,7 @@ where
|
||||
let config = &self.config;
|
||||
|
||||
let (host, port) = get_host_port(config, &dst)?;
|
||||
let host = host.trim_start_matches('[').trim_end_matches(']');
|
||||
|
||||
// If the host is already an IP addr (v4 or v6),
|
||||
// skip resolving the dns and start connecting right away.
|
||||
|
||||
Reference in New Issue
Block a user