8376031: HttpsURLConnection.getServerCertificates() throws "java.lang.IllegalStateException: connection not yet open" for the HEAD method#349
Conversation
|
👋 Welcome back rm-gh-8! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
This backport pull request has now been updated with issue from the original commit. |
Webrevs
|
phohensee
left a comment
There was a problem hiding this comment.
Please add the import of RSPBODY_EMPTY, but comment it out and add a reference to 8331195.
|
/approval request for backport of JDK-8376031: HttpsURLConnection.getServerCertificates() throws "java.lang.IllegalStateException: connection not yet open" for the HEAD method. This PR fixes HttpsURLConnection.getServerCertificates() throwing IllegalStateException after calling getResponseCode() on no-body responses by preserving the SSL session when HttpURLConnection automatically disconnects (sets http = null, connected = false) before returning the empty body stream, allowing SSL information extraction until explicit disconnect() is called. The PR contains a modified commit that defines RSPBODY_EMPTY as a local constant rather than using a static import in the GetServerCertificates.java test, since the static import depends on JDK-8331195, which requires CSR approval before backporting. For parity with Oracle JDK. Low risk - the change preserves existing behavior for normal responses while fixing the edge case of empty-body responses; the saved session is properly cleared on reconnection/disconnect to prevent stale data; comprehensive test coverage validates HEAD, 204, 304, and no-body 200 responses; refactoring consolidates session access logic without changing the public API contract. |
Backporting JDK-8376031: HttpsURLConnection.getServerCertificates() throws "java.lang.IllegalStateException: connection not yet open" for the HEAD method.
This PR fixes HttpsURLConnection.getServerCertificates() throwing IllegalStateException after calling getResponseCode() on no-body responses by preserving the SSL session when HttpURLConnection automatically disconnects (sets http = null, connected = false) before returning the empty body stream, allowing SSL information extraction until explicit disconnect() is called.
The PR contains a modified commit that defines RSPBODY_EMPTY as a local constant rather than using a static import in the GetServerCertificates.java test, since the static import depends on JDK-8331195, which requires CSR approval before backporting.
For parity with Oracle JDK.
Ran related tests on linux-x64, linux-aarch64, macos-aarch64 and windows-x64:
make test TEST=test/jdk/sun/net/www/protocol/https/HttpsURLConnection/GetServerCertificates.java
Results attached:
windows-x64-specific-test.log
macos-aarch64-specific-test.log
linux-x64-specific-test.log
linux-aarch64-specific-test.log
Progress
Integration blocker
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk25u-dev.git pull/349/head:pull/349$ git checkout pull/349Update a local copy of the PR:
$ git checkout pull/349$ git pull https://git.openjdk.org/jdk25u-dev.git pull/349/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 349View PR using the GUI difftool:
$ git pr show -t 349Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk25u-dev/pull/349.diff
Using Webrev
Link to Webrev Comment