FULL PRODUCT VERSION :
C:\Temp>java -version
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Sample proxy configuration for a LAN connection by completing these steps:
1. Click Start, and then click Control Panel.
2. Click Network and Internet, and then click Internet Options.
3. In the Internet Options dialog box, click the Connections tab.
4. Click the LAN Settings button.
5. To enable the use of a proxy server, check the box for “Use a proxy server for your LAN.
6. Enter the IP address of the proxy in the Address text box, i.e. wwwcache
7. Enter the port number of the proxy in the Port text box, i.e. 1234
8. To bypass the proxy server for local IP addresses, select the “Bypass proxy server for local addresses” checkbox.
9. Click Advanced
10. Enter the follwing addesses to the exception list:
*.oracle.com;212.201.100.*
11. Click OK to close the avanced settings.
12. Click OK to complete the proxy configuration process.
A DESCRIPTION OF THE PROBLEM :
Although the system proxy hostname and port are taken into account, the bypass exceptions are not. Obviously the '*' wildcards are not considered correctly. by the way, if a proxy pac specifiaction is given it is not taken into account at all:-(
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Enter the "Additional Configuration Information" as described above.
Compile the proived Source Code and run it as follows:
java -Djava.net.useSystemProxies=true testProxy
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java.net.useSystemProxies: null
http.proxyHost: wwwcache
http.proxyPort: 1234
http.nonproxyhosts: *.oracle.com|212.201.100.184
uri: http://www.oracle.com
proxy hostname : DIRECT
No Proxy
uri: http://212.201.100.184
proxy hostname : DIRECT
No Proxy
uri: http://www.yahoo.com
proxy hostname : HTTP
proxy hostname : wwwcache
proxy port : 1234
uri: http://localhost
proxy hostname : DIRECT
No Proxy
ACTUAL -
java.net.useSystemProxies: true
http.proxyHost: null
http.proxyPort: null
http.nonproxyhosts: null
uri: http://www.oracle.com
proxy hostname : HTTP
proxy hostname : wwwcache
proxy port : 1234
uri: http://212.201.100.184
proxy hostname : HTTP
proxy hostname : wwwcache
proxy port : 1234
uri: http://www.yahoo.com
proxy hostname : HTTP
proxy hostname : wwwcache
proxy port : 1234
uri: http://localhost
proxy hostname : DIRECT
No Proxy
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
import java.util.Iterator;
import java.util.List;
public class testProxy
{
/** derived from http://www.rgagnon.com/javadetails/java-0085.html */
public static void main(String[] args)
{
System.out.println("java.net.useSystemProxies: " + System.getProperty("java.net.useSystemProxies"));
System.out.println("http.proxyHost: " + System.getProperty("http.proxyHost"));
System.out.println("http.proxyPort: " + System.getProperty("http.proxyPort"));
System.out.println("http.nonproxyhosts: " + System.getProperty("http.nonProxyHosts"));
String[] uris = args != null && args.length > 0 ? args : new String[] {"http://www.oracle.com", "http://212.201.100.184", "http://www.yahoo.com", "http://localhost",};
for (final String uri : uris)
{
System.out.println("uri: " + uri);
try
{
ProxySelector dps = ProxySelector.getDefault();
URI URI = new URI(uri);
List<Proxy> pl = dps.select(URI);
for (Iterator<Proxy> pli = pl.iterator(); pli.hasNext();)
{
Proxy proxy = pli.next();
System.out.println(" proxy hostname : " + proxy.type());
InetSocketAddress addr = (InetSocketAddress)proxy.address();
if (addr == null)
{
System.out.println(" No Proxy");
}
else
{
System.out.println(" proxy hostname : " + addr.getHostName());
System.out.println(" proxy port : " + addr.getPort());
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Either enumerate the list of bypass addresses explicitly, e.g. "www.oracle.com;www1.oracle.com;212.201.100.184;..."
or fall back to the http.* properties where at least wildcards for FDNs are supported, e.g.
java -Dhttp.proxyHost=wwwcache -Dhttp.proxyPort=123 -Dhttp.nonProxyHosts="*.oracle.com|212.201.100.184" testProxy
However wildcards for IPs don't work either, e.g.
java -Dhttp.proxyHost=wwwcache -Dhttp.proxyPort=123 -Dhttp.nonProxyHosts="*.oracle.com|212.201.100.*" testProxy
does not show the expected result.
However, in most cases this workaround is not feasible.
C:\Temp>java -version
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Sample proxy configuration for a LAN connection by completing these steps:
1. Click Start, and then click Control Panel.
2. Click Network and Internet, and then click Internet Options.
3. In the Internet Options dialog box, click the Connections tab.
4. Click the LAN Settings button.
5. To enable the use of a proxy server, check the box for “Use a proxy server for your LAN.
6. Enter the IP address of the proxy in the Address text box, i.e. wwwcache
7. Enter the port number of the proxy in the Port text box, i.e. 1234
8. To bypass the proxy server for local IP addresses, select the “Bypass proxy server for local addresses” checkbox.
9. Click Advanced
10. Enter the follwing addesses to the exception list:
*.oracle.com;212.201.100.*
11. Click OK to close the avanced settings.
12. Click OK to complete the proxy configuration process.
A DESCRIPTION OF THE PROBLEM :
Although the system proxy hostname and port are taken into account, the bypass exceptions are not. Obviously the '*' wildcards are not considered correctly. by the way, if a proxy pac specifiaction is given it is not taken into account at all:-(
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Enter the "Additional Configuration Information" as described above.
Compile the proived Source Code and run it as follows:
java -Djava.net.useSystemProxies=true testProxy
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java.net.useSystemProxies: null
http.proxyHost: wwwcache
http.proxyPort: 1234
http.nonproxyhosts: *.oracle.com|212.201.100.184
uri: http://www.oracle.com
proxy hostname : DIRECT
No Proxy
uri: http://212.201.100.184
proxy hostname : DIRECT
No Proxy
uri: http://www.yahoo.com
proxy hostname : HTTP
proxy hostname : wwwcache
proxy port : 1234
uri: http://localhost
proxy hostname : DIRECT
No Proxy
ACTUAL -
java.net.useSystemProxies: true
http.proxyHost: null
http.proxyPort: null
http.nonproxyhosts: null
uri: http://www.oracle.com
proxy hostname : HTTP
proxy hostname : wwwcache
proxy port : 1234
uri: http://212.201.100.184
proxy hostname : HTTP
proxy hostname : wwwcache
proxy port : 1234
uri: http://www.yahoo.com
proxy hostname : HTTP
proxy hostname : wwwcache
proxy port : 1234
uri: http://localhost
proxy hostname : DIRECT
No Proxy
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
import java.util.Iterator;
import java.util.List;
public class testProxy
{
/** derived from http://www.rgagnon.com/javadetails/java-0085.html */
public static void main(String[] args)
{
System.out.println("java.net.useSystemProxies: " + System.getProperty("java.net.useSystemProxies"));
System.out.println("http.proxyHost: " + System.getProperty("http.proxyHost"));
System.out.println("http.proxyPort: " + System.getProperty("http.proxyPort"));
System.out.println("http.nonproxyhosts: " + System.getProperty("http.nonProxyHosts"));
String[] uris = args != null && args.length > 0 ? args : new String[] {"http://www.oracle.com", "http://212.201.100.184", "http://www.yahoo.com", "http://localhost",};
for (final String uri : uris)
{
System.out.println("uri: " + uri);
try
{
ProxySelector dps = ProxySelector.getDefault();
URI URI = new URI(uri);
List<Proxy> pl = dps.select(URI);
for (Iterator<Proxy> pli = pl.iterator(); pli.hasNext();)
{
Proxy proxy = pli.next();
System.out.println(" proxy hostname : " + proxy.type());
InetSocketAddress addr = (InetSocketAddress)proxy.address();
if (addr == null)
{
System.out.println(" No Proxy");
}
else
{
System.out.println(" proxy hostname : " + addr.getHostName());
System.out.println(" proxy port : " + addr.getPort());
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Either enumerate the list of bypass addresses explicitly, e.g. "www.oracle.com;www1.oracle.com;212.201.100.184;..."
or fall back to the http.* properties where at least wildcards for FDNs are supported, e.g.
java -Dhttp.proxyHost=wwwcache -Dhttp.proxyPort=123 -Dhttp.nonProxyHosts="*.oracle.com|212.201.100.184" testProxy
However wildcards for IPs don't work either, e.g.
java -Dhttp.proxyHost=wwwcache -Dhttp.proxyPort=123 -Dhttp.nonProxyHosts="*.oracle.com|212.201.100.*" testProxy
does not show the expected result.
However, in most cases this workaround is not feasible.
- duplicates
-
JDK-8195605 System proxy exclusion list parsing does not handle wildcard at the end like 192.168.1.*
-
- Closed
-
- relates to
-
JDK-8170868 DefaultProxySelector should use system defaults on Windows, MacOS and Gnome
-
- Closed
-