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:42:49 UTC 2022
On Mon, 19 Dec 2022 12:16:53 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> 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.
Actually - maybe I should go on and make the changes wrt GET and HEAD. The ProxyServer seems to have some code for this but it looks buggy.
-------------
PR: https://git.openjdk.org/jdk/pull/11717
More information about the net-dev
mailing list