Merged fixes from 4.1.x branches
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1080167 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
commit
1b1d692a3d
|
@ -1,5 +1,9 @@
|
||||||
Changes since 4.1
|
Changes since 4.1
|
||||||
|
|
||||||
|
* [HTTPCLIENT-1069] HttpHostConnectException not correctly retried for direct and non-tunnelled
|
||||||
|
proxy connections.
|
||||||
|
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||||
|
|
||||||
* [HTTPCLIENT-1066] Changed the way URIUtils#rewriteURI handles multiple consecutive slashes in the
|
* [HTTPCLIENT-1066] Changed the way URIUtils#rewriteURI handles multiple consecutive slashes in the
|
||||||
URI path component: multiple leading slashes will be replaced by one slash in order to avoid
|
URI path component: multiple leading slashes will be replaced by one slash in order to avoid
|
||||||
confusion with the authority component. The remaining content of the path will not be modified.
|
confusion with the authority component. The remaining content of the path will not be modified.
|
||||||
|
|
|
@ -340,12 +340,12 @@ public class SSLSocketFactory implements LayeredSchemeSocketFactory, LayeredSock
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public Socket createSocket(final HttpParams params) throws IOException {
|
public Socket createSocket(final HttpParams params) throws IOException {
|
||||||
return new Socket();
|
return this.socketfactory.createSocket();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Socket createSocket() throws IOException {
|
public Socket createSocket() throws IOException {
|
||||||
return new Socket();
|
return this.socketfactory.createSocket();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -552,9 +552,8 @@ public class DefaultRequestDirector implements RequestDirector {
|
||||||
final RoutedRequest req, final HttpContext context) throws HttpException, IOException {
|
final RoutedRequest req, final HttpContext context) throws HttpException, IOException {
|
||||||
HttpRoute route = req.getRoute();
|
HttpRoute route = req.getRoute();
|
||||||
|
|
||||||
boolean retrying = true;
|
|
||||||
int connectCount = 0;
|
int connectCount = 0;
|
||||||
while (retrying) {
|
for (;;) {
|
||||||
// Increment connect count
|
// Increment connect count
|
||||||
connectCount++;
|
connectCount++;
|
||||||
try {
|
try {
|
||||||
|
@ -564,7 +563,7 @@ public class DefaultRequestDirector implements RequestDirector {
|
||||||
managedConn.setSocketTimeout(HttpConnectionParams.getSoTimeout(params));
|
managedConn.setSocketTimeout(HttpConnectionParams.getSoTimeout(params));
|
||||||
}
|
}
|
||||||
establishRoute(route, context);
|
establishRoute(route, context);
|
||||||
retrying = false;
|
break;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
try {
|
try {
|
||||||
managedConn.close();
|
managedConn.close();
|
||||||
|
@ -596,9 +595,8 @@ public class DefaultRequestDirector implements RequestDirector {
|
||||||
HttpRoute route = req.getRoute();
|
HttpRoute route = req.getRoute();
|
||||||
HttpResponse response = null;
|
HttpResponse response = null;
|
||||||
|
|
||||||
boolean retrying = true;
|
|
||||||
Exception retryReason = null;
|
Exception retryReason = null;
|
||||||
while (retrying) {
|
for (;;) {
|
||||||
// Increment total exec count (with redirects)
|
// Increment total exec count (with redirects)
|
||||||
execCount++;
|
execCount++;
|
||||||
// Increment exec count for this particular request
|
// Increment exec count for this particular request
|
||||||
|
@ -616,11 +614,24 @@ public class DefaultRequestDirector implements RequestDirector {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (!managedConn.isOpen()) {
|
||||||
|
// If we have a direct route to the target host
|
||||||
|
// just re-open connection and re-try the request
|
||||||
|
if (!route.isTunnelled()) {
|
||||||
|
this.log.debug("Reopening the direct connection.");
|
||||||
|
managedConn.open(route, context, params);
|
||||||
|
} else {
|
||||||
|
// otherwise give up
|
||||||
|
this.log.debug("Proxied connection. Need to start over.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.log.isDebugEnabled()) {
|
if (this.log.isDebugEnabled()) {
|
||||||
this.log.debug("Attempt " + execCount + " to execute request");
|
this.log.debug("Attempt " + execCount + " to execute request");
|
||||||
}
|
}
|
||||||
response = requestExec.execute(wrapper, managedConn, context);
|
response = requestExec.execute(wrapper, managedConn, context);
|
||||||
retrying = false;
|
break;
|
||||||
|
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
this.log.debug("Closing the connection.");
|
this.log.debug("Closing the connection.");
|
||||||
|
@ -642,18 +653,6 @@ public class DefaultRequestDirector implements RequestDirector {
|
||||||
} else {
|
} else {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have a direct route to the target host
|
|
||||||
// just re-open connection and re-try the request
|
|
||||||
if (!route.isTunnelled()) {
|
|
||||||
this.log.debug("Reopening the direct connection.");
|
|
||||||
managedConn.open(route, context, params);
|
|
||||||
} else {
|
|
||||||
// otherwise give up
|
|
||||||
this.log.debug("Proxied connection. Need to start over.");
|
|
||||||
retrying = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
|
Loading…
Reference in New Issue