HTTPCLIENT-1405: CONNECT HTTP/1.1 requests lack mandatory 'Host' header

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1528325 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-10-02 07:28:04 +00:00
parent eeee0720b5
commit eeb3f4f1ca
3 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,9 @@
Changes since 4.3 Changes since 4.3
------------------- -------------------
* [HTTPCLIENT-1405] CONNECT HTTP/1.1 requests lack mandatory 'Host' header.
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1402] Cache default User-Agent value. * [HTTPCLIENT-1402] Cache default User-Agent value.
Contributed by yuexiaojun <junedo at qq.com> Contributed by yuexiaojun <junedo at qq.com>

View File

@ -73,6 +73,7 @@ import org.apache.http.protocol.HttpCoreContext;
import org.apache.http.protocol.HttpProcessor; import org.apache.http.protocol.HttpProcessor;
import org.apache.http.protocol.HttpRequestExecutor; import org.apache.http.protocol.HttpRequestExecutor;
import org.apache.http.protocol.ImmutableHttpProcessor; import org.apache.http.protocol.ImmutableHttpProcessor;
import org.apache.http.protocol.RequestTargetHost;
import org.apache.http.protocol.RequestUserAgent; import org.apache.http.protocol.RequestUserAgent;
import org.apache.http.util.Args; import org.apache.http.util.Args;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
@ -105,8 +106,8 @@ public class ProxyClient {
this.connFactory = connFactory != null ? connFactory : ManagedHttpClientConnectionFactory.INSTANCE; this.connFactory = connFactory != null ? connFactory : ManagedHttpClientConnectionFactory.INSTANCE;
this.connectionConfig = connectionConfig != null ? connectionConfig : ConnectionConfig.DEFAULT; this.connectionConfig = connectionConfig != null ? connectionConfig : ConnectionConfig.DEFAULT;
this.requestConfig = requestConfig != null ? requestConfig : RequestConfig.DEFAULT; this.requestConfig = requestConfig != null ? requestConfig : RequestConfig.DEFAULT;
this.httpProcessor = new ImmutableHttpProcessor(new RequestClientConnControl(), this.httpProcessor = new ImmutableHttpProcessor(
new RequestUserAgent()); new RequestTargetHost(), new RequestClientConnControl(), new RequestUserAgent());
this.requestExec = new HttpRequestExecutor(); this.requestExec = new HttpRequestExecutor();
this.proxyAuthStrategy = new ProxyAuthenticationStrategy(); this.proxyAuthStrategy = new ProxyAuthenticationStrategy();
this.authenticator = new HttpAuthenticator(); this.authenticator = new HttpAuthenticator();

View File

@ -69,6 +69,7 @@ import org.apache.http.message.BasicHttpRequest;
import org.apache.http.protocol.HttpProcessor; import org.apache.http.protocol.HttpProcessor;
import org.apache.http.protocol.HttpRequestExecutor; import org.apache.http.protocol.HttpRequestExecutor;
import org.apache.http.protocol.ImmutableHttpProcessor; import org.apache.http.protocol.ImmutableHttpProcessor;
import org.apache.http.protocol.RequestTargetHost;
import org.apache.http.protocol.RequestUserAgent; import org.apache.http.protocol.RequestUserAgent;
import org.apache.http.util.Args; import org.apache.http.util.Args;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
@ -117,7 +118,7 @@ public class MainClientExec implements ClientExecChain {
Args.notNull(userTokenHandler, "User token handler"); Args.notNull(userTokenHandler, "User token handler");
this.authenticator = new HttpAuthenticator(); this.authenticator = new HttpAuthenticator();
this.proxyHttpProcessor = new ImmutableHttpProcessor( this.proxyHttpProcessor = new ImmutableHttpProcessor(
new RequestClientConnControl(), new RequestUserAgent()); new RequestTargetHost(), new RequestClientConnControl(), new RequestUserAgent());
this.routeDirector = new BasicRouteDirector(); this.routeDirector = new BasicRouteDirector();
this.requestExecutor = requestExecutor; this.requestExecutor = requestExecutor;
this.connManager = connManager; this.connManager = connManager;