On 15/05/21 5:32 pm, Jaikiran Pai wrote:

On 15/05/21 5:13 pm, Jaikiran Pai wrote:
Hello Krzysztof,

On 15/05/21 1:07 am, Krzysztof K. wrote:
Hi,
I have an issue using http client communicating with servers that most probably are on GCP (I see header: "via: 1.1 google").

I get "java.io.IOException: Received RST_STREAM: Protocol error".
...

But I'm on JDK 16 (build 16+35-2229) and I get this error when connecting to a website when I use the header "TE: Trailers" (needs first letter capitalized).

When I remove this header everything works, if I switch to HTTP 1.1 (with that header) it also works.

Here is a minimal reproducible example:

HttpClient.newBuilder()
  .build()
  .send(
    HttpRequest.newBuilder()
    .header("TE", "Trailers")

IMO, this is more of an application issue than the JDK. In HTTP/2 the TE header[1] is expected to only have the value "trailers" (case sensitive) as noted here[2]. If you change your code to use "trailers" instead of "Trailers" it works (as you seem to have noticed). As for why it works in Firefox or curl, I'm not sure - perhaps they have special handling of this specific header to lower case its value if it's "Trailers"?

A quick check of the curl source code[1] suggests that it does indeed do special handling of this TE request param[2].

I meant request header.

-Jaikiran

Reply via email to