Details
Description
ResponseImpl.getCookies (which works via NewCookieHeaderProvider) does not work for cookies using the SameSite attribute.
Example:
System.out.println(new NewCookieHeaderProvider().fromString("Set-Cookie: sessionId=38afes7a8")) System.out.println(new NewCookieHeaderProvider().fromString("Set-Cookie: sessionId=38afes7a8;Comment=none")) System.out.println(new NewCookieHeaderProvider().fromString("Set-Cookie: sessionId=38afes7a8;SameSite=none"))
Expected output:
Set-Cookie: sessionId=38afes7a8;Version=1
Set-Cookie: sessionId=38afes7a8;Comment=none;Version=1
Set-Cookie: sessionId=38afes7a8;SameSite=none;Version=1
Current output:
Set-Cookie: sessionId=38afes7a8;Version=1
Set-Cookie: sessionId=38afes7a8;Comment=none;Version=1
SameSite=none;Version=1
Note that the SameSite attribute is mistaken for the cookie name and value.
In addition to explicitly supporting the SameSite attribute, it would be much better if the parser behaved in a forward-compatible manner, at the very least ignoring unknown attributes, or better, keeping them in a general attribute map. (Cf. Jakarta’s `Cookie` class.) See also the current valid Set-Cookie syntax.)