mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-22 10:01:32 +00:00
HTTPCLIENT-1069: HttpHostConnectException not correctly retried for direct and non-tunnelled proxy connections
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.1.x@1080165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
126f1da349
commit
490778e271
@ -1,5 +1,9 @@
|
||||
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
|
||||
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.
|
||||
|
@ -552,9 +552,8 @@ private void tryConnect(
|
||||
final RoutedRequest req, final HttpContext context) throws HttpException, IOException {
|
||||
HttpRoute route = req.getRoute();
|
||||
|
||||
boolean retrying = true;
|
||||
int connectCount = 0;
|
||||
while (retrying) {
|
||||
for (;;) {
|
||||
// Increment connect count
|
||||
connectCount++;
|
||||
try {
|
||||
@ -564,7 +563,7 @@ private void tryConnect(
|
||||
managedConn.setSocketTimeout(HttpConnectionParams.getSoTimeout(params));
|
||||
}
|
||||
establishRoute(route, context);
|
||||
retrying = false;
|
||||
break;
|
||||
} catch (IOException ex) {
|
||||
try {
|
||||
managedConn.close();
|
||||
@ -596,9 +595,8 @@ private HttpResponse tryExecute(
|
||||
HttpRoute route = req.getRoute();
|
||||
HttpResponse response = null;
|
||||
|
||||
boolean retrying = true;
|
||||
Exception retryReason = null;
|
||||
while (retrying) {
|
||||
for (;;) {
|
||||
// Increment total exec count (with redirects)
|
||||
execCount++;
|
||||
// Increment exec count for this particular request
|
||||
@ -616,11 +614,24 @@ private HttpResponse tryExecute(
|
||||
}
|
||||
|
||||
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()) {
|
||||
this.log.debug("Attempt " + execCount + " to execute request");
|
||||
}
|
||||
response = requestExec.execute(wrapper, managedConn, context);
|
||||
retrying = false;
|
||||
break;
|
||||
|
||||
} catch (IOException ex) {
|
||||
this.log.debug("Closing the connection.");
|
||||
@ -642,18 +653,6 @@ private HttpResponse tryExecute(
|
||||
} else {
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user