JDK-8280695 : Received RST_STREAM when connecting to https://google.com on HTTP/2
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 11.0.14
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2022-01-25
  • Updated: 2022-02-04
  • Resolved: 2022-02-04
Related Reports
Duplicate :  
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
On 11.0.13, you could make a request to https://google.com with the following:

import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Foo {
    public static void main(String[] args) throws IOException, InterruptedException {
        HttpClient client = HttpClient.newBuilder().build();
        HttpRequest req = HttpRequest.newBuilder(URI.create("https://google.com")).build();
        client.send(req, HttpResponse.BodyHandlers.ofString());
    }
}

It appears that "8213189: Make restricted headers in HTTP Client configurable and remove Date by default" introduced a breaking change in 11.0.14 such that the above code now throws

Exception in thread "main" java.io.IOException: Received RST_STREAM: Protocol error
	at java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:565)
	at java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:119)
	at Foo.main(Foo.java:16)
Caused by: java.io.IOException: Received RST_STREAM: Protocol error

This is a critical regression for many that rely on Google APIs (and several others) over HTTP/2 to function.


REGRESSION : Last worked in version 11

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Foo {
    public static void main(String[] args) throws IOException, InterruptedException {
        HttpClient client = HttpClient.newBuilder().build();
        HttpRequest req = HttpRequest.newBuilder(URI.create("https://google.com")).build();
        client.send(req, HttpResponse.BodyHandlers.ofString());
    }
}

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
To not receive: java.io.IOException: Received RST_STREAM: Protocol error 
ACTUAL -
Receive: java.io.IOException: Received RST_STREAM: Protocol error

---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Foo {
    public static void main(String[] args) throws IOException, InterruptedException {
        HttpClient client = HttpClient.newBuilder().build();
        HttpRequest req = HttpRequest.newBuilder(URI.create("https://google.com")).build();
        client.send(req, HttpResponse.BodyHandlers.ofString());
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Stay on 11.0.3

FREQUENCY : always



Comments
Closing as a duplicate of JDK-8218546
04-02-2022

The observations on Windows 10: JDK 11.0.13.0.3: Passed. JDK 11.0.13.1: Failed, Received RST_STREAM: Protocol error JDK 17.0.3ea+3: Passed. JDK 18ea+29: Passed. JDK 19ea+3: Passed.
26-01-2022

Isn't that a duplicate of JDK-8280685?
26-01-2022