On Thu, 29 Jan 2026 15:32:50 GMT, Daniel Fuchs <[email protected]> wrote:
> The issue here is that `HttpURLConnection` is automatically disconnected > (`HttpClient` is set to `null`, `connected` is set to `false`) when a > response with no response body bytes is received. This happens before a fake > empty body input stream is returned to the user. That behaviour also occurs > with any method for which `content-length: 0` is returned (GET, POST, custom, > anything), and with any status code (204, 304) for which there is no body. > > In this case, the proposed fix is to store the `SSLSession` in the > `AbstractDelegateHttpsURLConnection` subclass until such a time where > `disconnect()` is explicitely closed. Information pertaining to SSL, such as > server certificates, can be extracted from the saved `SSLSession`. This pull request has now been integrated. Changeset: d7523ec8 Author: Daniel Fuchs <[email protected]> URL: https://git.openjdk.org/jdk/commit/d7523ec8d2255675547c0746d076efd7af5dd5af Stats: 499 lines in 4 files changed: 403 ins; 83 del; 13 mod 8376031: HttpsURLConnection.getServerCertificates() throws "java.lang.IllegalStateException: connection not yet open" for the HEAD method Reviewed-by: jpai ------------- PR: https://git.openjdk.org/jdk/pull/29489
