/// <exception cref="System.IO.IOException"></exception> /// <exception cref="Apache.Http.Client.ClientProtocolException"></exception> protected internal override CloseableHttpResponse DoExecute(HttpHost target, IHttpRequest request, HttpContext context) { Args.NotNull(request, "HTTP request"); HttpExecutionAware execAware = null; if (request is HttpExecutionAware) { execAware = (HttpExecutionAware)request; } try { HttpRequestWrapper wrapper = HttpRequestWrapper.Wrap(request); HttpClientContext localcontext = ((HttpClientContext)HttpClientContext.Adapt(context != null ? context : new BasicHttpContext())); RequestConfig config = null; if (request is Configurable) { config = ((Configurable)request).GetConfig(); } if (config == null) { HttpParams @params = request.GetParams(); if (@params is HttpParamsNames) { if (!((HttpParamsNames)@params).GetNames().IsEmpty()) { config = HttpClientParamConfig.GetRequestConfig(@params); } } else { config = HttpClientParamConfig.GetRequestConfig(@params); } } if (config != null) { localcontext.SetRequestConfig(config); } SetupContext(localcontext); HttpRoute route = DetermineRoute(target, wrapper, localcontext); return(this.execChain.Execute(route, wrapper, localcontext, execAware)); } catch (HttpException httpException) { throw new ClientProtocolException(httpException); } }
public ProxyClient(HttpParams @params) : this(null, HttpParamConfig.GetConnectionConfig (@params), HttpClientParamConfig.GetRequestConfig(@params)) { }