RFR: 8319531: FileServerHandler::discardRequestBody could be improved [v3]
Jaikiran Pai
jpai at openjdk.org
Wed Nov 15 06:26:30 UTC 2023
On Mon, 13 Nov 2023 15:25:25 GMT, Darragh Clarke <dclarke at openjdk.org> wrote:
>> **Problem**
>> `discardRequestBody` calls `InputStream::readAllBytes` to read and discard all the request body bytes. This is somewhat wasteful as they can instead be skipped.
>>
>> **Changes**
>> - Updated `FileServerHandler::discardRequestBody` to use `InputStream::skip`.
>> - Created skip in `LeftOverInputStream` based on [InputStream](https://github.com/openjdk/jdk/blob/c9657cad124d2be10b8d6006d0ca9a038b1c5945/src/java.base/share/classes/java/io/InputStream.java#L540). This gets used by `FixedLengthInputStream` and `ChunkedInputStream` which previously had been using the skip implementation from `FilteredInputStream` which would have caused blocking.
>>
>> - Also made a minor change to `LeftOverInputStream::Drain` to change bufSize.
>>
>>
>> I ran test tiers 1-3 and all tests are passing with these changes
>
> Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision:
>
> updated drain to use the new skip method
Looks good to me, after what Daniel noted.
-------------
Marked as reviewed by jpai (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/16616#pullrequestreview-1731312466
More information about the net-dev
mailing list