From b95f92e1bc07b413d51c9d297de97ab50a754da6 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Bonnet Date: Mon, 11 Feb 2013 18:44:15 +0000 Subject: [PATCH] HTTPCLIENT-1321: DefaultHttpClient ignores cookie policy git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1444920 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/http/impl/client/AbstractHttpClient.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java b/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java index 1d91429d6..43c1fe691 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java @@ -54,10 +54,12 @@ import org.apache.http.client.RedirectHandler; import org.apache.http.client.RedirectStrategy; import org.apache.http.client.RequestDirector; import org.apache.http.client.UserTokenHandler; +import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.params.AuthPolicy; import org.apache.http.client.params.ClientPNames; import org.apache.http.client.params.CookiePolicy; +import org.apache.http.client.params.HttpClientParamConfig; import org.apache.http.client.protocol.ClientContext; import org.apache.http.conn.ClientConnectionManager; import org.apache.http.conn.ClientConnectionManagerFactory; @@ -801,6 +803,10 @@ public abstract class AbstractHttpClient extends CloseableHttpClient { } else { execContext = new DefaultedHttpContext(context, defaultContext); } + final HttpParams params = determineParams(request); + final RequestConfig config = HttpClientParamConfig.getRequestConfig(params); + execContext.setAttribute(ClientContext.REQUEST_CONFIG, config); + // Create a director for this request director = createClientRequestDirector( getRequestExecutor(), @@ -814,7 +820,7 @@ public abstract class AbstractHttpClient extends CloseableHttpClient { getTargetAuthenticationStrategy(), getProxyAuthenticationStrategy(), getUserTokenHandler(), - determineParams(request)); + params); routePlanner = getRoutePlanner(); connectionBackoffStrategy = getConnectionBackoffStrategy(); backoffManager = getBackoffManager();