On Thu, 18 Nov 2021 19:49:19 GMT, Daniel Fuchs <dfu...@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. > > Daniel Fuchs has updated the pull request with a new target base due to a > merge or a rebase. The incremental webrev excludes the unrelated changes > brought in by the merge/rebase. The pull request contains six additional > commits since the last revision: > > - Merge branch 'master' into user-cookie-8276774 > - Improved comment as requested during review > - More cleanup > - Minor cleanup > - Updated tests > - 8276774: Cookie stored in CookieHandler not sent if user headers contain > cookie src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 659: > 657: > 658: // Filter any headers from systemHeaders that are set in > userHeaders > 659: // except for "Cookies" - user cookies will be appended to > system Hello Daniel, A minor comment issue - "Cookie" instead of "Cookies", perhaps? test/jdk/java/net/httpclient/UserCookieTest.java line 2: > 1: /* > 2: * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. Should the year be 2021? ------------- PR: https://git.openjdk.java.net/jdk/pull/6408