On Mon, 15 Sep 2025 02:50:27 GMT, Josiah Noel <[email protected]> wrote:

> Following the direction outlined in the net-dev discussion, I've updated the 
> `com.sun.net.httpserver.Headers.normalize()` method to no longer allocate a 
> superfluous char array when the header is already normalized.

Inspired from your changes, I've put together [this 
patch](https://github.com/user-attachments/files/23579262/headerNormalize.patch)
 containing following changes:

- Ventilate and document `Headers::normalize`
- Convert the method to `private static`
- Extend tests
- Add a benchmark

@SentryMan, unless you have remarks/objections, would you mind applying the 
patch, please?

For the record, we internally discussed two other related issues:

- The inconsistency between `Headers::getFirst` and `Headers::keySet::get`
- Switching from the first-letter-in-upper-case normalization form to 
all-lower-case – This would ease the cognitive load, simplify the 
implementation (i.e. maintainability & efficiency gains), match the RFC 
recommendations:
  
  > "Field names MUST be converted to lowercase when constructing an HTTP/2 
message." – [RFC 9113: HTTP/2 > 8. Expressing HTTP Semantics in HTTP/2 > 8.2. 
HTTP Fields](https://www.rfc-editor.org/rfc/rfc9113#section-8.2)
  
  But this might break certain applications relying on the existing behaviour.

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

PR Comment: https://git.openjdk.org/jdk/pull/27276#issuecomment-3540930536

Reply via email to