Lab Notes

Things I want to remember how to do.

Frame Size Issue with Java HTTP Client

April 19, 2021

If you hit this error when using the HTTP client built into Java:

Caused by: java.io.IOException: protocol error: Frame type(80) length(4740180) exceeds MAX_FRAME_SIZE(16384)
        at jdk.internal.net.http.Http2Connection.protocolError(Http2Connection.java:952) ~[java.net.http:?]
        at jdk.internal.net.http.Http2Connection.processFrame(Http2Connection.java:714) ~[java.net.http:?]
        at jdk.internal.net.http.frame.FramesDecoder.decode(FramesDecoder.java:155) ~[java.net.http:?]

Try using a client configured for HTTP 1.1:

        client = HttpClient.newBuilder()
            .followRedirects(HttpClient.Redirect.ALWAYS)
            .version(HttpClient.Version.HTTP_1_1)
            .build();