RFR: 8347167: Implementation in com.sun.net.httpserver.Headers.normalize() can be improved [v2]

Daniel Fuchs dfuchs at openjdk.org
Wed Nov 19 12:33:26 UTC 2025


On Wed, 19 Nov 2025 10:06:10 GMT, Michael McMahon <michaelm at openjdk.org> wrote:

>> @Michael-Mc-Mahon, very good (embarrassing :facepalm:) catch!
>> 
>> @dfuch, I guess `httpserver/HeadersTest.java` needs a serious overhaul against these kind of normalization edge cases. I will try tackling this tomorrow (CET). @SentryMan, let me know if you prefer picking this up yourself.
>
> The other issue you found at line 135 raises the question to _how_ strings that don't start with a letter are normalized? (A) Do we only ever put the first character as uppercase (if it's a letter)? Or (B) do we always put the first letter in a string in uppercase, wherever it appears in the string? 
> 
> Looks like the current behavior is (A) and we should stick with that, from the point of view of new tests. So, `2xyz` would be normalized as `2xyz`, but `xyz2` would be normalized as `Xyz2`. Does that make sense?

That's what I would expect yes. 

2xyz -> 2xyz
2xyZ -> 2xyz
xyz2 -> Xyz2
Xy2Z -> Xy2z
xYZ2 -> Xyz2

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27276#discussion_r2541811987


More information about the net-dev mailing list