RFR: 8351347: HttpClient Improve logging of response headers

Daniel Fuchs dfuchs at openjdk.org
Tue May 13 13:56:00 UTC 2025


On Tue, 13 May 2025 08:15:34 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

> Includes request method, request URI, response status code, and HTTP/2 stream ID while logging response headers in the HTTP Client.
> 
> ### Demonstration
> 
> Snippets from running JTreg against `test/jdk/java/net/httpclient/HeadTest.java`:
> 
> **Before:**
> 
> INFO: HEADERS: RESPONSE HEADERS:
>     connection: Upgrade
>     upgrade: h2c
> ...
> INFO: HEADERS: RESPONSE HEADERS:
>     :status: 304
>     content-length: 300
> 
> 
> **After:** 
> 
> INFO: HEADERS: RESPONSE HEADERS:
>   GET http://127.0.0.1:48497/ 101
>     connection: Upgrade
>     upgrade: h2c
> ...
> INFO: HEADERS: RESPONSE HEADERS (streamid=1):
>   GET http://127.0.0.1:48497/ 304
>     :status: 304
>     content-length: 300

Very nice!

It would be good to add the `(streamId=<streamId>)` at line 676 too in Stream.java (Trailing Headers),  and to add the whole line (`GET <uri> <status-code>`) at line 1782 (push response headers).

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

PR Comment: https://git.openjdk.org/jdk/pull/25201#issuecomment-2876622516


More information about the net-dev mailing list