mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8220663: Incorrect handling of IPv6 addresses in Socket(Proxy.HTTP)
Reviewed-by: alanb, michaelm
This commit is contained in:
parent
3b0ae8082a
commit
5ee0711360
2 changed files with 79 additions and 34 deletions
|
@ -114,14 +114,17 @@ import java.util.Set;
|
|||
if (endpoint == null || !(endpoint instanceof InetSocketAddress))
|
||||
throw new IllegalArgumentException("Unsupported address type");
|
||||
final InetSocketAddress epoint = (InetSocketAddress)endpoint;
|
||||
final String destHost = epoint.isUnresolved() ? epoint.getHostName()
|
||||
: epoint.getAddress().getHostAddress();
|
||||
String destHost = epoint.isUnresolved() ? epoint.getHostName()
|
||||
: epoint.getAddress().getHostAddress();
|
||||
final int destPort = epoint.getPort();
|
||||
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null)
|
||||
security.checkConnect(destHost, destPort);
|
||||
|
||||
if (destHost.contains(":"))
|
||||
destHost = "[" + destHost + "]";
|
||||
|
||||
// Connect to the HTTP proxy server
|
||||
String urlString = "http://" + destHost + ":" + destPort;
|
||||
Socket httpSocket = privilegedDoTunnel(urlString, timeout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue