RFR: 8349670: HttpServer: sending interim responses fails after JDK-7026262 [v18]

Daniel Fuchs dfuchs at openjdk.org
Thu Oct 9 17:42:03 UTC 2025


On Thu, 9 Oct 2025 17:25:55 GMT, Josiah Noel <duke at openjdk.org> wrote:

>> Following the guideline of the last comment on [JDK-8349670](https://bugs.openjdk.org/browse/JDK-8349670?focusedId=14794649&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14794649), resolves the issue where sending a 1xx status code would close the input stream, preventing the server from reading the body. 
>> 
>> - When a 1xx status code is sent by `sendResponseHeaders`, the input/output streams will not be closed prematurely.
>> - sentHeaders will not be set to true when sending 1xx status codes
>> - 100-continue will be sent automatically when trying to read the inputstream if `Expect: 100-continue` header is present
>
> Josiah Noel has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Update Send1xxResponsesTest.java
>  - pr comments

test/jdk/com/sun/net/httpserver/Send1xxResponsesTest.java line 98:

> 96:     @Test
> 97:     public void testManualContinue() throws Exception {
> 98:         System.out.println("testAutoContinue()");

Suggestion:

        System.out.println("testManualContinue()");

test/jdk/com/sun/net/httpserver/Send1xxResponsesTest.java line 192:

> 190:             // there's more into the request.
> 191:             writer.print(body);
> 192:             System.out.println("Client wrote body to socket: " + socket);

if expectContinue == true shouldn't we wait to get the first 100 before sending the body?
or maybe not - the spec allows for the client to send the body before receiving 100 because servers might ignore the Expect header... Since we're testing the server side here - maybe it's fine to send the body immediately as you suggest.

test/jdk/com/sun/net/httpserver/Send1xxResponsesTest.java line 221:

> 219:             // Assert that the received status codes match the expected ones
> 220:             if (statusCodes.size() != expectedStatusCodes.length) {
> 221:                 throw new IOException("Expected " + expectedStatusCodes.length + " status codes, but got " + statusCodes.size());

it would be more informative to print the two lists here - rather than the lengths.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27069#discussion_r2417469431
PR Review Comment: https://git.openjdk.org/jdk/pull/27069#discussion_r2417460219
PR Review Comment: https://git.openjdk.org/jdk/pull/27069#discussion_r2417465319


More information about the net-dev mailing list