On Thu, 7 Nov 2024 11:06:20 GMT, Daniel Jeliński <[email protected]> wrote:
> This PR fixes an intermittent test failure on Windows. The test server used
> in HttpURLConnectionExpect100Test now reads from the socket until the client
> closes it.
>
> The current implementation closes the server socket after reading the request
> headers, but without reading the request body. On Windows, if any data is
> left in the socket receive buffer when the socket is closed, the connection
> is reset. If the client doesn't read the response before the connection is
> reset, the response is lost and the test fails.
>
> Verified that:
> - the test still passes
> - waiting for the client to close the socket does not take excessive amounts
> of time (the test finishes in half a second on my machine)
Marked as reviewed by jpai (Reviewer).
test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpect100Test.java line
222:
> 220: }
> 221: // wait until the client closes the socket
> 222: while (line != null) {
Hello Daniel, does the code ever enter this `while` loop? If I'm reading the
above few lines correctly, then when the code exits the previous `do while`
loop then `line` would be `null` and `line` appears to continue being `null`
when it reaches here.
-------------
PR Review: https://git.openjdk.org/jdk/pull/21948#pullrequestreview-2420889873
PR Review Comment: https://git.openjdk.org/jdk/pull/21948#discussion_r1832620712