On Thu, 4 Sep 2025 22:05:33 GMT, Josiah Noel <[email protected]> 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. 
>> 
>> - Adds a new flag checking if the incoming request is an upgrade request.
>> - When receiving an upgrade request, directly return the input/output stream
>> - 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
>
> It turns out I had previously signed the OCA but forgot to put my GH username 
> on it. 
> 
> Edit: no wait my OCA does have my GH username on it?

Hi @SentryMan, thanks for contributing!

The informational response handling looks good, but the upgrades need to be 
handled differently. If we start treating every request with an `Upgrade` 
header as an upgrade, we will invalidate pretty much every existing application 
that uses the httpserver. We need a check that the application understands the 
semantics of the `Upgrade` header before we proceed with the upgrade.

Both uses of the `Upgrade` header (WebSockets and HTTP/2 upgrade) provide means 
for the server to accept or reject the upgrade. In both cases the server is 
required to send a `101 Switching protocols` response, any other response means 
that the server decided to keep using HTTP 1.1.

The second issue is resource handling. The server keeps a list of all active 
connections and exchanges. The existing OutputStream classes like 
`UndefLengthOutputStream` notify the server when the exchange finishes, 
permitting it to close the exchange and remove the connection from the active 
connection list as needed. Here you give the raw input/output streams to the 
user; the raw streams do not notify the server, so the server's bookkeeping 
will be incorrect.

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

PR Comment: https://git.openjdk.org/jdk/pull/27069#issuecomment-3323119186

Reply via email to