RFR: 8304963: HttpServer closes connection after processing HEAD after JDK-7026262

Daniel Jeliński djelinski at openjdk.org
Mon Mar 27 18:51:20 UTC 2023


This PR fixes a regression introduced in [JDK-7026262](https://bugs.openjdk.org/browse/JDK-7026262); we started closing the exchange instead of the output stream, and exchange closes the connection when wrapped stream is not set. As an unintended side effect, the server started closing connections after handling a HEAD request.

The proposed change is to set the wrapped stream to a zero-length FixedLengthOutputStream before closing the exchange. This allows the connection to be reused.

The attached test verifies if 2 consecutive HEAD requests use the same connection. It succeeds with the proposed change, fails without it. All other tier1-3 tests continue to pass.

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

Commit messages:
 - Keep connection after HEAD request

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

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


More information about the net-dev mailing list