On Fri, 4 Mar 2022 11:10:40 GMT, Mahendra Chhipa <[email protected]> wrote:
>> test/jdk/sun/net/www/http/KeepAliveCache/B5045306.java line 206:
>>
>>> 204: // override the Content-length header to be greater
>>> than the actual response body
>>> 205: trans.getResponseHeaders().set("Content-length",
>>> Integer.toString(responseBody.length+1));
>>> 206: trans.sendResponseHeaders(200, 0);
>>
>> Here again we will be mixing Content-Length and chunked
>
> In case of HttpExchange.setResponseHeader(). If responseLength is -1, then
> content-length value is overridden to 0, if already set explicitly. Same is
> the case when responseLength is > 0. Only in the case when responseLength ==
> 0, content-length value is not overriden if already set explicitly., that's
> why I am using chunked encoding and writing the data less than the content
> length.
I understand why you do it - but the client will react differently if both
Content-Length *and* chunk are specified, as opposed to when only
Content-Length is specified. So I just want to make sure that we are testing
the same thing than before. If we are not testing the same thing, then you
might have to use a ServerSocket directly - rather than an HttpServer, to make
sure we're sending back the same things than before.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7616