Skip to content

Commit 6589785

Browse files
committed
Don't force CONNECT on HTTP/1.0, add a ProxyServer parameter, close AsyncHttpClient#892
1 parent ba3889e commit 6589785

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/main/java/com/ning/http/client/ProxyServer.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public String toString() {
6060
private String ntlmDomain = System.getProperty("http.auth.ntlm.domain", "");
6161
private String ntlmHost;
6262
private AuthScheme scheme = AuthScheme.BASIC;
63+
private boolean forceHttp10 = false;
6364

6465
public ProxyServer(final Protocol protocol, final String host, final int port, String principal, String password) {
6566
this.protocol = protocol;
@@ -163,6 +164,14 @@ public void setNtlmHost(String ntlmHost) {
163164
public String getUrl() {
164165
return url;
165166
}
167+
168+
public boolean isForceHttp10() {
169+
return forceHttp10;
170+
}
171+
172+
public void setForceHttp10(boolean forceHttp10) {
173+
this.forceHttp10 = forceHttp10;
174+
}
166175

167176
@Override
168177
public String toString() {

src/main/java/com/ning/http/client/providers/netty/request/NettyRequestFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public NettyRequest newNettyRequest(Request request, Uri uri, boolean forceConne
271271
throws IOException {
272272

273273
HttpMethod method = forceConnect ? HttpMethod.CONNECT : HttpMethod.valueOf(request.getMethod());
274-
HttpVersion httpVersion = method == HttpMethod.CONNECT ? HttpVersion.HTTP_1_0 : HttpVersion.HTTP_1_1;
274+
HttpVersion httpVersion = method == HttpMethod.CONNECT && proxyServer.isForceHttp10() ? HttpVersion.HTTP_1_0 : HttpVersion.HTTP_1_1;
275275
String requestUri = requestUri(uri, proxyServer, method);
276276

277277
NettyBody body = body(request, method);

0 commit comments

Comments
 (0)