On Fri, 10 Oct 2025 21:22:49 GMT, Josiah Noel <[email protected]> wrote:

>> - adds a flag to ExchangeImpl to signal whether the current request is an 
>> Upgrade request
>> - Adds a new `UpgradeInputStream` to ensure that the server keeps track of 
>> when the upgraded request is closed
>> - on 101 response codes, `sendResponseHeaders` will not immediately close 
>> the output stream 
>> - on 101 response codes, `sendResponseHeaders` will use an 
>> `UndefLengthOutputStream`
>
> Josiah Noel has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update UpgradeInputStream.java

src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java line 172:

> 170:         if (upgrade) {
> 171:             uis_orig = new UpgradeInputStream(this, ris);
> 172:         } else if (reqContentLen == -1L) {

Are we sure that `upgrade` and `reqConteLength != 0` are always exclusive? IIRC 
this is not the case for the HTTP/2 upgrade. The request body (if present) is 
sent through HTTP/1.1 and only after that is the connection upgraded to HTTP/2 
- if the upgrade is accepted. Also the handler could very well ignore the 
upgrade and continue with HTTP/1.1.

It seems we need more discussion on whether we should support connection 
upgrade and what kind of API would be needed for that.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27751#discussion_r2426749626

Reply via email to