RFR: 8293786: HttpClient will not send more than 64 kb of data from the 2nd request in http2 [v4]

Conor Cleary ccleary at openjdk.org
Wed Apr 26 15:04:24 UTC 2023


On Wed, 26 Apr 2023 14:51:23 GMT, Conor Cleary <ccleary at openjdk.org> wrote:

>> Thanks for the feedback Daniel. I see the issue that my implementation causes if the handler closes the `bos` early. Working on this now as a priority, solution will try to make sure that this RST_STREAM is sent even if the handler looks like the example you gave above. Probably worth inluding these handlers as test cases also.
>
> So to address this in the most recent commit, the BodyOutputStream initalised in the try-with-resources block is now passed a reference to the given BodyInputStream and it is used to check if a reset is required there once it is closed. This is done with the following in BodyOutputStream.java:
> 
> 
> private boolean resetNeeded() throws IOException {
>         return (bis != null && (!bis.isEof() || bis.q.size() > 0));
> }
> 
> 
> For the `sendResponseHeaders(200, -1)` case, a reset has to be triggered to send instead once the BodyOutputStream is closed at the beginning of the exchange (because of the negative content length).

I could use opinions on the handling of the negative content length (i.e. no content) case. The following code in `Http2TestExchangeImpl.sendResponseHeaders()` handles this and the `rCode == 204` case like so:

        if (responseLength < 0 || rCode == 204) {
            response.setFlag(HeadersFrame.END_STREAM);
            conn.outputQ.put(response);
            conn.outputQ.put(new ResetFrame(streamid, ResetFrame.NO_ERROR));
            os.markClosed();
        } else {
            conn.outputQ.put(response);
        }
        os.goodToGo();
        System.err.println("Sent response headers " + rCode);

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/12694#discussion_r1178008300


More information about the net-dev mailing list