RFR: 8299018: java/net/httpclient/HttpsTunnelAuthTest.java fails with java.io.IOException: HTTP/1.1 header parser received no bytes [v2]

Daniel Fuchs dfuchs at openjdk.org
Mon Dec 19 12:19:50 UTC 2022


On Mon, 19 Dec 2022 10:42:48 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update test/jdk/java/net/httpclient/ProxyServer.java
>>   
>>   Co-authored-by: Daniel Jelinski <djelinski1 at gmail.com>
>
> test/jdk/java/net/httpclient/ProxyServer.java line 459:
> 
>> 457:             int n = -1;
>> 458:             try {
>> 459:                 n = Integer.parseInt(cl);
> 
> Hello Daniel, is it expected that the `content-length` header will always be present and if it isn't then the `ProxyServer` is expected to close the connection?
> In its current form (even without the changes in this PR), if the `content-length` header is missing, this block will run into a `NumberFormatException` leading to the connection closure. Is that OK?

The idea is that the connection can be reused only if the ProxyServer knows how many bytes it should read from the connection to get to the next request. Otherwise the connection will be closed. So if using chunked encoding or if no content-length is given the ProxyServer will simply close the connection. Maybe a smarter implementation could deal with chunked encoding and also look at the request method and accept that no content length means 0 in case of HEAD or GET - but that's not part of this fix.

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

PR: https://git.openjdk.org/jdk/pull/11717


More information about the net-dev mailing list