Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8198709

Redirect from HTTP/1.1 with Upgrade to HTTP/2 over TLS erroneously includes Upgrade header

    Details

      Description

      $ cat Get.java

      import java.net.InetSocketAddress;
      import java.net.ProxySelector;
      import java.net.URI;
      import jdk.incubator.http.HttpClient;
      import jdk.incubator.http.HttpRequest;
      import jdk.incubator.http.HttpResponse;

      class Get {

         public static void main(String... args) {
             HttpClient.newBuilder()
                     .followRedirects(HttpClient.Redirect.ALWAYS)
                     .build()
                     .sendAsync(HttpRequest.newBuilder(URI.create(args[0])).build(), HttpResponse.BodyHandler.asString())
                     .thenApply(HttpResponse::body)
                     .thenAccept(System.out::println)
                     .join();
         }

      }
      $ ./build/macosx-x86_64-normal-server-release/images/jdk/bin/java --add-modules jdk.incubator.httpclient Get http://stackoverflow.com/
      WARNING: Using incubator modules: jdk.incubator.httpclient
      Exception in thread “main” java.util.concurrent.CompletionException: java.io.IOException: /10.175.196.73:49421: GOAWAY received
          at java.base/java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:367)
          at java.base/java.util.concurrent.CompletableFuture.completeRelay(CompletableFuture.java:376)
          at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1074)
          at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
          at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
          at jdk.incubator.httpclient/jdk.incubator.http.Stream.completeResponseExceptionally(Stream.java:874)
          at jdk.incubator.httpclient/jdk.incubator.http.Stream.cancelImpl(Stream.java:925)
          at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.shutdown(Http2Connection.java:555)
          at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleGoAway(Http2Connection.java:780)
          at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleConnectionFrame(Http2Connection.java:680)
          at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.processFrame(Http2Connection.java:593)
          at jdk.incubator.httpclient/jdk.incubator.http.internal.frame.FramesDecoder.decode(FramesDecoder.java:156)
          at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection$FramesController.processReceivedData(Http2Connection.java:195)
          at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.asyncReceive(Http2Connection.java:528)
          at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection$Http2TubeSubscriber.processQueue(Http2Connection.java:1054)
          at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler$SynchronizedRestartableTask.run(SequentialScheduler.java:175)
          at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:147)
          at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:198)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
          at java.base/java.lang.Thread.run(Thread.java:844)
      Caused by: java.io.IOException: /10.175.196.73:49421: GOAWAY received
          at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleGoAway(Http2Connection.java:781)
          ... 12 more

        Attachments

          Activity

            People

            • Assignee:
              chegar Chris Hegarty
              Reporter:
              chegar Chris Hegarty
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: