RFR: 8368695: Support 101 switching protocol in jdk.httpserver

Josiah Noel duke at openjdk.org
Sat Oct 25 18:05:38 UTC 2025


Remaking the PR since I messed up the upstream merge on the other one.

- adds a flag to ExchangeImpl to signal whether the current request is a GET Upgrade request
- Adds a new `UpgradeInputStream`/`UpgradeOutputStream` 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 `UpgradeInputStream`

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

Commit messages:
 - Merge branch 'master' into JDK-8368695
 - reduce diff
 - Merge remote-tracking branch 'upstream/master' into JDK-8368695
 - Update SwitchingProtocolTest.java
 - Update SwitchingProtocolTest.java
 - Update SwitchingProtocolTest.java
 - add exception test
 - Create UpgradeOutputStream.java
 - close raw streams
 - tab
 - ... and 7 more: https://git.openjdk.org/jdk/compare/c3449de2...355732aa

Changes: https://git.openjdk.org/jdk/pull/27989/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27989&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8368695
  Stats: 456 lines in 4 files changed: 449 ins; 2 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/27989.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27989/head:pull/27989

PR: https://git.openjdk.org/jdk/pull/27989


More information about the net-dev mailing list