Integrated: 8276774: Cookie stored in CookieHandler not sent if user headers contain cookie

Daniel Fuchs dfuchs at openjdk.java.net
Fri Nov 19 13:21:48 UTC 2021


On Tue, 16 Nov 2021 13:00:31 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> Hi,
> 
> Please find enclosed a patch that solves an unexpected interaction between server-set cookies and user-set cookies in the `java.net.HttpClient`.
> 
> In JDK 12 we fixed [JDK-8213189](https://bugs.openjdk.java.net/browse/JDK-8213189) to allow user-supplied header to take precedence over (that is, replace) system-headers. 
> At the time the fact that server cookies would be added to the system-supplied headers by the `CookieHandler` (if present), and that a user-supplied cookie would therefore replace them (instead of simply appending to them)  was overlooked.
> 
> This fix proposes to restore the behavior of JDK 11 WRT to cookies - and arrange for user-supplied cookies to be appended to server-supplied cookies.

This pull request has now been integrated.

Changeset: 03debf27
Author:    Daniel Fuchs <dfuchs at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/03debf277537135974d3f55e3a5c7cf6842ee5e0
Stats:     82 lines in 4 files changed: 35 ins; 18 del; 29 mod

8276774: Cookie stored in CookieHandler not sent if user headers contain cookie

Reviewed-by: michaelm

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

PR: https://git.openjdk.java.net/jdk/pull/6408


More information about the net-dev mailing list