On Thu, 7 Nov 2024 12:44:21 GMT, Jaikiran Pai <j...@openjdk.org> 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) > > 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. Hi Jaikiran, the previous while loop is usually exited with a zero-length line. Null is only returned on EOF. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21948#discussion_r1832623658