RFR: 8289291: HttpServer sets incorrect value for "max" parameter in Keep-Alive header value [v2]

Jaikiran Pai jpai at openjdk.org
Wed Jun 29 15:19:48 UTC 2022


On Wed, 29 Jun 2022 15:12:01 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> Just wondering about using a simple Socket as the client (which is fine). I'd expect it should be possible to see the value of the header with the new HttpClient (unless we filter it?).

The Http(s)Server will set the `Keep-Alive` header only if the incoming request is a `HTTP/1.0` version https://github.com/openjdk/jdk/blob/master/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java#L668. The new HttpClient (and even the old HttpURLConnection) both use a minimum of HTTP 1.1 for requests. So the server won't exercise this piece of code for setting the `Keep-Alive` header, if we use either the new HttpClient or the HttpURLConnection.

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

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


More information about the net-dev mailing list