From 40bf945d04e550bb5098aec7823d4ab91ead4a9d Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Wed, 9 Jan 2013 14:12:11 +0000 Subject: [PATCH] Small tweaks to MinimalHttpClient git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1430867 13f79535-47bb-0310-9956-ffa450edef68 --- .../http/impl/client/MinimalHttpClient.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/httpclient/src/main/java/org/apache/http/impl/client/MinimalHttpClient.java b/httpclient/src/main/java/org/apache/http/impl/client/MinimalHttpClient.java index 865b4cd2f..981e52eaf 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/MinimalHttpClient.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/MinimalHttpClient.java @@ -79,12 +79,6 @@ class MinimalHttpClient extends CloseableHttpClient { this.params = new BasicHttpParams(); } - private HttpClientContext setupContext(final HttpContext localContext) { - HttpClientContext context = HttpClientContext.adapt( - localContext != null ? localContext : new BasicHttpContext()); - return context; - } - @Override protected CloseableHttpResponse doExecute( final HttpHost target, @@ -98,20 +92,16 @@ class MinimalHttpClient extends CloseableHttpClient { } try { HttpRequestWrapper wrapper = HttpRequestWrapper.wrap(request); - HttpClientContext localcontext = setupContext(context); + HttpClientContext localcontext = HttpClientContext.adapt( + context != null ? context : new BasicHttpContext()); HttpRoute route = new HttpRoute(target); RequestConfig config = null; if (request instanceof Configurable) { config = ((Configurable) request).getConfig(); } - if (config == null) { - config = RequestConfig.DEFAULT; + if (config != null) { + localcontext.setRequestConfig(config); } - if (config.getProxy() != null) { - throw new ClientProtocolException("Minimal HttpClient does not support" + - " request execution via proxy"); - } - localcontext.setRequestConfig(config); return this.requestExecutor.execute(route, wrapper, localcontext, execAware); } catch (HttpException httpException) { throw new ClientProtocolException(httpException);