src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/WebSocketImpl.java
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/WebSocketImpl.java Thu Nov 16 12:15:55 2017 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/WebSocketImpl.java Thu Nov 16 19:56:44 2017 +0000
@@ -122,13 +122,12 @@
* Returns the proxy for the given URI when sent through the given client,
* or {@code null} if none is required or applicable.
*/
- private static Proxy proxyFor(HttpClient client, URI uri) {
- Optional<ProxySelector> optional = client.proxy();
- if (!optional.isPresent()) {
+ private static Proxy proxyFor(Optional<ProxySelector> selector, URI uri) {
+ if (!selector.isPresent()) {
return null;
}
URI requestURI = OpeningHandshake.createRequestURI(uri); // based on the HTTP scheme
- List<Proxy> pl = optional.get().select(requestURI);
+ List<Proxy> pl = selector.get().select(requestURI);
if (pl.isEmpty()) {
return null;
}
@@ -164,7 +163,7 @@
static CompletableFuture<WebSocket> newInstanceAsync(BuilderImpl b) {
// TODO: a security issue? TOCTOU: two accesses to b.getURI
- Proxy proxy = proxyFor(b.getClient(), b.getUri());
+ Proxy proxy = proxyFor(b.proxySelector(), b.getUri());
try {
checkPermissions(b, proxy);
} catch (Throwable throwable) {