DefaultProxySelector socks override

Chris Hegarty chris.hegarty at oracle.com
Wed Mar 27 15:54:20 UTC 2013


[cc'ing net-dev, we can then probably drop core-libs-dev and continue 
the discussion over on net-dev]

Christos,

SOCKS is really old and not as widely deployed as other proxies. That 
said, I don't have any specific problem with your proposal. SOCKS is 
really in maintenance mode in the JDK, but I do see this as a reasonable 
request/proposal.

Since socksNonProxyHosts is only set on Mac I can only presume that it 
is a remanent of the mac port. I would prefer to make the cosmetic 
changes as part of this patch. I cannot see that we need to keep 
socksNonProxyHosts, as it does nothing in the JDK anyway.

Can you do this?

-Chris.

On 03/27/2013 02:41 PM, christos at zoulas.com wrote:
> 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
>



More information about the core-libs-dev mailing list