Fix missing Partitioned cookie support in reactive HTTP clients

This commit adds support for the Partitioned cookie attribute in the
reactive HTTP clients that support this: Reactor and HttpComponents.

Closes gh-34521

Signed-off-by: Rhett CfZhuang <dark.momo985@gmail.com>
[brian.clozel@broadcom.com: rework tests and support HttpComponents]
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
This commit is contained in:
Rhett CfZhuang
2025-02-28 23:20:36 +08:00
committed by Brian Clozel
parent d2733cea36
commit 5faf2ed7f4
3 changed files with 30 additions and 1 deletions

View File

@@ -90,6 +90,7 @@ class HttpComponentsClientHttpResponse extends AbstractClientHttpResponse {
.maxAge(getMaxAgeSeconds(cookie))
.secure(cookie.isSecure())
.httpOnly(cookie.containsAttribute("httponly"))
.partitioned(cookie.containsAttribute("partitioned"))
.sameSite(cookie.getAttribute("samesite"))
.build());
}

View File

@@ -148,6 +148,7 @@ class ReactorClientHttpResponse implements ClientHttpResponse {
.secure(cookie.isSecure())
.httpOnly(cookie.isHttpOnly())
.sameSite(getSameSite(cookie))
.partitioned(getPartitioned(cookie))
.build()));
return CollectionUtils.unmodifiableMultiValueMap(result);
}
@@ -160,6 +161,13 @@ class ReactorClientHttpResponse implements ClientHttpResponse {
return null;
}
private static boolean getPartitioned(Cookie cookie) {
if (cookie instanceof DefaultCookie defaultCookie) {
return defaultCookie.isPartitioned();
}
return false;
}
/**
* Called by {@link ReactorClientHttpConnector} when a cancellation is detected
* but the content has not been subscribed to. If the subscription never