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