This trivial patch add "socksNonProxyHosts" to the default proxy,
so that we can select which socket traffic will be directed to
the proxy and which not. There is currently no way to do this. In
my scenario, I have applications that would benefit in terms of
performance to connect directly to our internal network hosts, and
at the same time need to connect to the outside via our socks proxy.
Having all of them go through the socks proxy would require me to
buy a very expensive proxy, and suffer the latency anyway. I would 
also like to note that the "socksNonProxyHosts" variable is in:

jdk/src/share/native/java/lang/System.c:        PUTPROP(props, 
"socksNonProxyHosts", sprops->exceptionList);

for MacOS/X but nowhere else. Finally (not in this patch), it would
be nice to provide socks.nonProxyHosts etc. to be symmetric with the
other http, https, and ftp variables. But this is purely cosmetic. And
here's the patch...

Enjoy,

christos

--- jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java.orig    Wed Mar 
27 10:26:36 2013 -0400
+++ jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java Wed Mar 27 
10:28:15 2013 -0400
@@ -124,6 +124,7 @@
         final String defaultVal;
         static NonProxyInfo ftpNonProxyInfo = new 
NonProxyInfo("ftp.nonProxyHosts", null, null, defStringVal);
         static NonProxyInfo httpNonProxyInfo = new 
NonProxyInfo("http.nonProxyHosts", null, null, defStringVal);
+        static NonProxyInfo socksNonProxyInfo = new 
NonProxyInfo("socksNonProxyHosts", null, null, defStringVal);
 
         NonProxyInfo(String p, String s, RegexpPool pool, String d) {
             property = p;
@@ -186,7 +187,9 @@
             pinfo = NonProxyInfo.httpNonProxyInfo;
         } else if ("ftp".equalsIgnoreCase(protocol)) {
             pinfo = NonProxyInfo.ftpNonProxyInfo;
-        }
+        } else if ("socket".equalsIgnoreCase(protocol)) {
+            pinfo = NonProxyInfo.socksNonProxyInfo;
+        }
 
         /**
          * Let's check the System properties for that protocol

Reply via email to