RFR: 8349670: HttpServer: sending interim responses fails after JDK-7026262 [v21]
Josiah Noel
duke at openjdk.org
Fri Oct 10 14:35:05 UTC 2025
On Thu, 9 Oct 2025 18:12:52 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 one additional commit since the last revision:
>
> Update Send1xxResponsesTest.java
It occurs to me, that there is actually no practical reason for this PR. For the 100-continue case, there are better ways to handle it than `sendResponseHeaders` or even a new public `sendIntermediateResponse` method. The best method I think would be to be like jetty and move the auto-send-continue logic to when the inputstream is read. This is because trying to read the input stream implies that you're okay to receive the body.
For connection upgrades, this PR is also unrelated as besides keeping the inputstream open, it otherwise behaves like other status codes and doesn't require sending 101 and then some other status.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27069#issuecomment-3390488501
More information about the net-dev
mailing list