On Tue, 25 Nov 2025 21:01:44 GMT, Volkan Yazici <[email protected]> wrote:

>> src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 1786:
>> 
>>> 1784:                    sure code up the stack handles NFE correctly. */
>>> 1785:                 responseHeaders.firstValueAsLong("content-length");
>>> 1786: 
>> 
>> We no longer check here that content-length is a number if present. Has that 
>> become unecessary?
>
> This is a fast-path to exit early if `Content-Length` is present and cannot 
> be parsed into a `long`. AFAICT,
> 
> - The author was already either aware of the missing `Content-Length` checks, 
> or suspecting that. Therefore he introduced this rudimentary check.
> - This concern is only relevant for `Content-Length` consumers, where we 
> thoroughly validate the value at each use-site in this PR.

Introduced dangling `firstValueAsLong("content-length")` calls back in 
0af344f1839. I will tackle this particular issue more comprehensively in a 
follow-up ticket.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28431#discussion_r2564456304

Reply via email to