Skip to content

Commit a9ab0fa

Browse files
authored
fix(socks): bracket IPv6 addresses when formatting destination host (#2753)
1 parent b739726 commit a9ab0fa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/connect.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,13 @@ mod socks {
12941294
.next();
12951295
if let Some(new_target) = maybe_new_target {
12961296
log::trace!("socks local dns resolved {new_target:?}");
1297-
host = new_target.ip().to_string();
1297+
// If the resolved IP is IPv6, wrap it in brackets for URI formatting
1298+
let ip = new_target.ip();
1299+
if ip.is_ipv6() {
1300+
host = format!("[{}]", ip);
1301+
} else {
1302+
host = ip.to_string();
1303+
}
12981304
}
12991305
}
13001306

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy