On Tue, 2 Dec 2025 10:42:02 GMT, Sergey Chernyshev <[email protected]> wrote:
>> src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java line >> 478: >> >>> 476: !IPAddressUtil.isIPv4LiteralAddress(host) >>> && >>> 477: !(host.charAt(0) == '[' && >>> host.charAt(host.length() - 1) == ']' && >>> 478: >>> IPAddressUtil.isIPv6LiteralAddress(host.substring(1, host.length() - 1)) >> >> The `host` value here comes from `URL.getHost()` which specifies that it >> returns an IPv6 address enclosed in `[]`brackets. So what you have here >> looks fine to me. >> >> One additional thing I would suggest is to make this `protected String host` >> field of this class `final`. It currently gets assigned in the constructor >> of the `HttpClient` and `HttpsClient` and making this `final` would give an >> extra assurance that its value will always be coming from `URL.getHost()` >> call. >> >> These 2 `sun.net.www.http.HttpClient` and `HttpsClient` classes are internal >> to the JDK, so changing this protected field to final shouldn't cause any >> issues for application code. > > @jaikiran I think this deserves a separate issue. I could file a bug for this. Yes, it's OK with me if you don't change this field to `final` in this PR. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28577#discussion_r2580627052
