RFR: 8231632: HttpURLConnection::usingProxy could specify that it may lazily evaluate the fact

Julia Boes julia.boes at oracle.com
Thu Oct 17 09:21:25 UTC 2019


Hi,

This fix involves HttpURLConnection::usingProxy.

Previously, the method would return true only once the connection was 
established (once the underlying socket was connected) and would switch 
back to false when as the input stream was fully read. The new 
implementation checks whether an explicit proxy is set and if not, it 
invokes the ProxySelector to determine if a proxy is used. This widens 
the window in which the method returns a meaningful value. This is a 
best-effort as it might not always be able to determine if a proxy is 
actually used before the connection is established, as the ProxySelector 
might return different results when connect is called.

An apinote is added to clarify the behaviour.

Bug: https://bugs.openjdk.java.net/browse/JDK-8231632

Webrev: 
http://cr.openjdk.java.net/~jboes/webrevs/8231632/webrev.00/index.html

I'll create a CSR for this once I gathered some feedback on this solution.

The fix was tested with JCK java_net and tier 1 - 3.

Regards,

Julia


More information about the net-dev mailing list