Issue with HTTP/2 communicating with GCP servers with TE: Trailers

Jaikiran Pai jai.forums2013 at
Sat May 15 11:43:20 UTC 2021

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 " 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"?




More information about the net-dev mailing list