mirror of
https://github.com/rustdesk/hbb_common.git
synced 2026-10-23 16:50:32 +00:00
fix: bracket IPv6 targets in HTTP CONNECT requests
This commit is contained in:
1 parent
3aade011c0
commit
9ee2f3ef9a
2 files changed
+11
-1
No files matched your search
@@ -663,6 +663,10 @@ impl Proxy {
|
||||
|
||||
fn get_domain_and_port<'a>(target_addr: &TargetAddr<'a>) -> Result<(String, u16), ProxyError> {
|
||||
match target_addr {
|
||||
// CONNECT requires brackets around IPv6 literals in both the target and Host header.
|
||||
tokio_socks::TargetAddr::Ip(SocketAddr::V6(addr)) => {
|
||||
Ok((format!("[{}]", addr.ip()), addr.port()))
|
||||
}
|
||||
tokio_socks::TargetAddr::Ip(addr) => Ok((addr.ip().to_string(), addr.port())),
|
||||
tokio_socks::TargetAddr::Domain(name, port) => Ok((name.to_string(), *port)),
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user