RFR: 8369595: HttpClient: HttpHeaders.firstValueAsLong failures should be converted to ProtocolException [v8]
Daniel Fuchs
dfuchs at openjdk.org
Thu Dec 11 13:28:35 UTC 2025
On Tue, 9 Dec 2025 20:28:14 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
>> Add guards against `HttpHeaders::firstValueAsLong` failures. `H3MalformedResponseTest` is overhauled – migrated to JUnit, reinforced with exception type tests, etc. – but not all `firstValueAsLong` changes are verified with new additional tests. `test/jdk/java/net/httpclient/` tests still do pass.
>
> Volkan Yazici has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits:
>
> - Pull changes from upstream
> - Merge remote-tracking branch 'upstream/master' into firstValueAsLong
> - Close connection after `Content-Length` read failure in `Http1Response`
> - Insert the redundant `Http3Stream` assert back
> - Introduce dangling `firstValueAsLong("content-length")` calls back
> - Document `Http1Response::ignoreBody`
> - Remove redundant `finally`
> - Use `-1` as default in `Http3ExchangeImpl`
> - Use `readStatusCode()` in `Http3Stream`
> - Replace `orElse(null)` with `Optional` usage
> - ... and 8 more: https://git.openjdk.org/jdk/compare/786833cd...b677820c
src/java.net.http/share/classes/jdk/internal/net/http/Http3ExchangeImpl.java line 1303:
> 1301: promiseHeaders, "illegal push headers for pushId=%s: ".formatted(pushId), -1);
> 1302: if (clen > 0) {
> 1303: throw new ProtocolException("push headers contain non-zero \"Content-Length\" for pushId=" + pushId);
Nit - the exception for Transfer-Encoding below doesn't have double quotes around Transfer-Encoding. I don't mind adding double quotes here but maybe they should be added below too for consistency.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28431#discussion_r2609814834
More information about the net-dev
mailing list