On Tue, 21 Apr 2026 09:06:42 GMT, Volkan Yazici <[email protected]> wrote:

>> Per [RFC 6066 "3. Server Name Indication"], disallow IP literals in 
>> `SNIHostName::new`.
>> 
>> While the following two call-sites could be simplified by removing IP 
>> literal checks, I've refrained from doing so because delegating some of the 
>> checks to an exception catching mechanism would impact the performance:
>> 
>>     sun.security.ssl.Utilities::rawToSNIHostName
>>     sun.net.www.protocol.https.HttpsClient::afterConnect
>> 
>> [RFC 6066 "3. Server Name Indication"]: 
>> https://www.rfc-editor.org/rfc/rfc6066.html#page-6
>> 
>> ---------
>> - [X] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Volkan Yazici has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Add `ofString` static factory method

In b2c40b2541a,

- I've added the `ofString()` static factory method
- I've updated the `SNIHostName(String)` ctor specification:
  - I've placed the interesting bits (i.e., what qualifies as an illegal host 
name) to the top
  - I've moved ASCII/IDN validation story to a dedication subsection
  - I've added an `@apiNote` to advice users to prefer `ofString()` instead 
(this was suggested by @dfuch, IIRC)
- In the `ofString()` specification, I've added an `@apiNote` to advice users 
to have a `catch (IAE)` safety net

An alternative direction could be making the new `SNIHostName(String hostname, 
boolean strict)` ctor `public` instead of adding a new static factory method.

Note that this is a draft to have a feeling on the end result — 
`SNIHostName(byte[])`/tests/etc. are not adapted yet.

@AlanBateman, @dfuch, @djelinski, would you mind reviewing these changes, 
please? How shall I proceed?

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

PR Comment: https://git.openjdk.org/jdk/pull/30747#issuecomment-4287301468

Reply via email to