RFR: 8352502: Response message is null if expect 100 assertion fails with non 100 [v2]

Daniel Fuchs dfuchs at openjdk.org
Tue Jul 8 14:51:43 UTC 2025


On Tue, 8 Jul 2025 14:33:04 GMT, Darragh Clarke <dclarke at openjdk.org> wrote:

>> Currently if a request has set Expect-Continue and receives a non 100 response the `responseMessage` wouldn't be set.
>> 
>> This PR sets `responseMessage`, it also updates `getResponseMessage` to check if the message has already been set. This should match the way that `responseCode` is currently handled.
>> 
>> I also added a test to cover some possible responses.
>
> Darragh Clarke 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 six additional commits since the last revision:
> 
>  - removed unneeded library
>  - more cleanup
>  - moved test, implemented feedback
>  - merged master into branch
>  - implementing comments
>  - Response Message could be null

Changes requested by dfuchs (Reviewer).

test/jdk/java/net/HttpURLConnection/HttpUrlConnectionExpectContinueResponseMessageTest.java line 177:

> 175:                 .loopback()
> 176:                 .port(control.serverSocket.getLocalPort())
> 177:                 .toURL();

It could be good to add some salt to the URL path here, and verify the path on the server side, to weed out any random connections that could be made to our server by other processes.

You'd need to have validated the path before assigning control.acceptingSocket, and just close the accepted socket (or better send something like a 500 response before closing the socket) if the path doesn't match the expectation.

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

PR Review: https://git.openjdk.org/jdk/pull/25999#pullrequestreview-2997999954
PR Review Comment: https://git.openjdk.org/jdk/pull/25999#discussion_r2192736405


More information about the net-dev mailing list