On Tue, 11 Aug 2026 07:28:49 GMT, Volkan Yazici <[email protected]> wrote:

>> Ensure `HttpServer` doesn't close connection after zero-length requests.
>> 
>> ---------
>> - [X] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Volkan Yazici has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains five additional 
> commits since the last revision:
> 
>  - Merge remote-tracking branch 'upstream/master' into hsDrainAmount
>  - Convert `NoContentReturningHandler` to a class
>  - Fix comment on `SocketException("EOF")`
>  - Fix `@bug` tags
>  - Fix the `eof` handling in `FixedLengthInputStream`

test/jdk/com/sun/net/httpserver/property/DrainAmountPropertyTest.java line 174:

> 172:         var inputStream = clientSocket.getInputStream();
> 173:         assertEquals("HTTP/1.1 204 No Content", 
> readUntilCrLf(inputStream));
> 174:         while (!readUntilCrLf(inputStream).isEmpty());

I haven't grasped what this while loop is for. Can a brief comment be added for 
it?

test/jdk/com/sun/net/httpserver/property/DrainAmountPropertyTest.java line 184:

> 182:             if (nextChar < 0) {
> 183:                 // Peer disconnect is not expected, escalate it
> 184:                 throw new SocketException("EOF");

For debugging purposes, would it better to even print what's been read so far? 
Something like:

if (nextChar < 0) {
    // Peer disconnect is not expected, escalate it
    System.err.println("read so far: " + buffer);
    throw new SocketException("EOF");

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32234#discussion_r3757677304
PR Review Comment: https://git.openjdk.org/jdk/pull/32234#discussion_r3757686049

Reply via email to