You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2025/02/05 16:24:02 UTC

(httpcomponents-client) 01/01: HTTPCLIENT-2361: Tolerate multiple `Cookie` headers added by the caller

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch HTTPCLIENT-2361
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit b7ece752eb52450c6190ae002ae84293ac56b5a9
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Wed Feb 5 17:16:39 2025 +0100

    HTTPCLIENT-2361: Tolerate multiple `Cookie` headers added by the caller
---
 .../java/org/apache/hc/client5/http/protocol/RequestAddCookies.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAddCookies.java b/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAddCookies.java
index 836c988cf..cf50c999c 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAddCookies.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAddCookies.java
@@ -91,9 +91,8 @@ public void process(final HttpRequest request, final EntityDetails entity, final
             return;
         }
 
-        final Header cookieHeader = request.getHeader(HttpHeaders.COOKIE);
         // Check if a Cookie header is already present
-        if (cookieHeader != null) {
+        if (request.containsHeader(HttpHeaders.COOKIE)) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Skipping cookie addition, Cookie header already present in the request");
             }