src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java
branchhttp-client-branch
changeset 56128 249a863b0aca
parent 56104 3420c1bdd254
child 56166 56c52d6417d1
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java	Wed Feb 14 17:02:56 2018 +0000
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java	Wed Feb 14 17:35:42 2018 +0000
@@ -420,13 +420,13 @@
     }
 
     static String keyFor(HttpConnection connection) {
-        boolean isProxy = connection.isProxied();
+        boolean isProxy = connection.isProxied(); // tunnel or plain clear connection through proxy
         boolean isSecure = connection.isSecure();
         InetSocketAddress addr = connection.address();
 
         return keyString(isSecure, isProxy, addr.getHostString(), addr.getPort());
     }
-
+    
     static String keyFor(URI uri, InetSocketAddress proxy) {
         boolean isSecure = uri.getScheme().equalsIgnoreCase("https");
         boolean isProxy = proxy != null;
@@ -434,10 +434,16 @@
         String host;
         int port;
 
-        if (proxy != null) {
+        if (proxy != null && !isSecure) {
+            // clear connection through proxy: use
+            // proxy host / proxy port
             host = proxy.getHostString();
             port = proxy.getPort();
         } else {
+            // either secure tunnel connection through proxy
+            // or direct connection to host, but in either
+            // case only that host can be reached through
+            // the connection: use target host / target port
             host = uri.getHost();
             port = uri.getPort();
         }