src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ExchangeImpl.java
branchhttp-client-branch
changeset 55983 e4a1f0c9d4c6
parent 55973 4d9b002587db
child 55993 087a6b6d4955
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ExchangeImpl.java	Thu Dec 14 12:28:32 2017 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ExchangeImpl.java	Thu Dec 14 18:41:57 2017 +0000
@@ -103,6 +103,7 @@
                              "handling HTTP/2 connection creation failed: %s",
                              (Object)t);
             t = Utils.getCompletionCause(t);
+            boolean secure = exchange.request().secure();
             if (t instanceof Http2Connection.ALPNException) {
                 Http2Connection.ALPNException ee = (Http2Connection.ALPNException)t;
                 AbstractAsyncSSLConnection as = ee.getConnection();
@@ -110,6 +111,11 @@
                 CompletableFuture<? extends ExchangeImpl<U>> ex =
                         createHttp1Exchange(exchange, as);
                 return ex;
+            } else if (secure && c== null) {
+                DEBUG_LOGGER.log(Level.DEBUG, "downgrading to HTTP/1.1 ");
+                CompletableFuture<? extends ExchangeImpl<U>> ex =
+                        createHttp1Exchange(exchange, null);
+                return ex;
             } else {
                 DEBUG_LOGGER.log(Level.DEBUG, "HTTP/2 connection creation failed "
                                   + "with unexpected exception: %s", (Object)t);