Hi,
Chris and Daniel provided some off-list feedback regarding the
ProxySelector::select call. It returns a list of proxies, which could be
dynamic. Each call can potentially return a different list of proxies so
it's not desirable to make that call twice. An alternative is to
maintain a class field that is set to true in the connect method, as
done in the updated webrev.
Webrev:
http://cr.openjdk.java.net/~jboes/webrevs/8231632/webrev.01/index.html
Regards,
Julia
On 17/10/2019 10:21, Julia Boes wrote:
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