HTTPCLIENT-1285: request configuration in the context to remain unchanged if not explicitly overridden by the request

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1426771 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2012-12-29 15:28:04 +00:00
parent 712cafd1e9
commit c2dd3ccc44
1 changed files with 9 additions and 3 deletions

View File

@ -30,6 +30,7 @@ package org.apache.http.impl.client;
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
@ -87,7 +88,7 @@ class InternalHttpClient extends CloseableHttpClient {
private final CredentialsProvider credentialsProvider;
private final RequestConfig defaultConfig;
private final List<Closeable> closeables;
private final HttpParams params;
private final BasicHttpParams params;
public InternalHttpClient(
final ClientExecChain execChain,
@ -173,9 +174,14 @@ class InternalHttpClient extends CloseableHttpClient {
config = this.defaultConfig;
}
if (config == null) {
Set<String> names = params.getNames();
if (!names.isEmpty()) {
config = HttpClientParamConfig.getRequestConfig(params);
}
}
if (config != null) {
localcontext.setRequestConfig(config);
}
return this.execChain.execute(route, wrapper, localcontext, execAware);
} catch (HttpException httpException) {
throw new ClientProtocolException(httpException);