HTTPCLIENT-1321: DefaultHttpClient ignores cookie policy

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1444920 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Francois-Xavier Bonnet 2013-02-11 18:44:15 +00:00
parent 7e081f0d5c
commit b95f92e1bc
1 changed files with 7 additions and 1 deletions

View File

@ -54,10 +54,12 @@ import org.apache.http.client.RedirectHandler;
import org.apache.http.client.RedirectStrategy; import org.apache.http.client.RedirectStrategy;
import org.apache.http.client.RequestDirector; import org.apache.http.client.RequestDirector;
import org.apache.http.client.UserTokenHandler; 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.methods.CloseableHttpResponse;
import org.apache.http.client.params.AuthPolicy; import org.apache.http.client.params.AuthPolicy;
import org.apache.http.client.params.ClientPNames; import org.apache.http.client.params.ClientPNames;
import org.apache.http.client.params.CookiePolicy; 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.client.protocol.ClientContext;
import org.apache.http.conn.ClientConnectionManager; import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.ClientConnectionManagerFactory; import org.apache.http.conn.ClientConnectionManagerFactory;
@ -801,6 +803,10 @@ public abstract class AbstractHttpClient extends CloseableHttpClient {
} else { } else {
execContext = new DefaultedHttpContext(context, defaultContext); 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 // Create a director for this request
director = createClientRequestDirector( director = createClientRequestDirector(
getRequestExecutor(), getRequestExecutor(),
@ -814,7 +820,7 @@ public abstract class AbstractHttpClient extends CloseableHttpClient {
getTargetAuthenticationStrategy(), getTargetAuthenticationStrategy(),
getProxyAuthenticationStrategy(), getProxyAuthenticationStrategy(),
getUserTokenHandler(), getUserTokenHandler(),
determineParams(request)); params);
routePlanner = getRoutePlanner(); routePlanner = getRoutePlanner();
connectionBackoffStrategy = getConnectionBackoffStrategy(); connectionBackoffStrategy = getConnectionBackoffStrategy();
backoffManager = getBackoffManager(); backoffManager = getBackoffManager();