From 3100ef22e9ed9f57b4cbc1a737a89bd64541687d Mon Sep 17 00:00:00 2001 From: thc202 Date: Thu, 18 Jan 2018 15:37:09 +0000 Subject: [PATCH] Force cookies on same Cookie header --- .../apache/commons/httpclient/HttpMethodBase.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/org/apache/commons/httpclient/HttpMethodBase.java b/src/org/apache/commons/httpclient/HttpMethodBase.java index c0d627c9311..0c32c49e17a 100644 --- a/src/org/apache/commons/httpclient/HttpMethodBase.java +++ b/src/org/apache/commons/httpclient/HttpMethodBase.java @@ -1347,17 +1347,8 @@ protected void addCookieRequestHeader(HttpState state, HttpConnection conn) } Cookie[] cookies = matcher.match(host, conn.getPort(), getPath(), conn.isSecure(), state.getCookies()); - if ((cookies != null) && (cookies.length > 0)) { - if (getParams().isParameterTrue(HttpMethodParams.SINGLE_COOKIE_HEADER)) { - // In strict mode put all cookies on the same header - putAllCookiesInASingleHeader(host, matcher, cookies); - } else { - // In non-strict mode put each cookie on a separate header - for (int i = 0; i < cookies.length; i++) { - String s = matcher.formatCookie(cookies[i]); - getRequestHeaderGroup().addHeader(new Header(HttpHeader.COOKIE, s, true)); - } - } + if ((cookies != null && cookies.length > 0) || cookieheaders.length > 0) { + putAllCookiesInASingleHeader(host, matcher, cookies); if (matcher instanceof CookieVersionSupport) { CookieVersionSupport versupport = (CookieVersionSupport) matcher; int ver = versupport.getVersion();