HTTPCLIENT-852: Fixed bug causing automatically retried redirects fail with CircularRedirectException

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@780611 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2009-06-01 10:39:05 +00:00
parent 7d39f392f6
commit 6681a1193d
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,10 @@
Changes since 4.0 beta 2 Changes since 4.0 beta 2
------------------- -------------------
* [HTTPCLIENT-852] Fixed bug causing automatically retried redirects fail with
CircularRedirectException.
Contributed by Oleg Kalnichevski <olegk at apache.org>
* Fixed problem with the default HTTP response parser failing to handle garbage * Fixed problem with the default HTTP response parser failing to handle garbage
preceding a valid HTTP response. preceding a valid HTTP response.
Contributed by Oleg Kalnichevski <olegk at apache.org> Contributed by Oleg Kalnichevski <olegk at apache.org>

View File

@ -333,9 +333,9 @@ public class DefaultRequestDirector implements RequestDirector {
int execCount = 0; int execCount = 0;
boolean reuse = false; boolean reuse = false;
HttpResponse response = null;
boolean done = false; boolean done = false;
try { try {
HttpResponse response = null;
while (!done) { while (!done) {
// In this loop, the RoutedRequest may be replaced by a // In this loop, the RoutedRequest may be replaced by a
// followup request and route. The request and route passed // followup request and route. The request and route passed
@ -344,6 +344,7 @@ public class DefaultRequestDirector implements RequestDirector {
RequestWrapper wrapper = roureq.getRequest(); RequestWrapper wrapper = roureq.getRequest();
HttpRoute route = roureq.getRoute(); HttpRoute route = roureq.getRoute();
response = null;
// See if we have a user token bound to the execution context // See if we have a user token bound to the execution context
Object userToken = context.getAttribute(ClientContext.USER_TOKEN); Object userToken = context.getAttribute(ClientContext.USER_TOKEN);
@ -471,7 +472,7 @@ public class DefaultRequestDirector implements RequestDirector {
// If we have a direct route to the target host // If we have a direct route to the target host
// just re-open connection and re-try the request // just re-open connection and re-try the request
if (route.getHopCount() == 1) { if (!route.isTunnelled()) {
this.log.debug("Reopening the direct connection."); this.log.debug("Reopening the direct connection.");
managedConn.open(route, context, params); managedConn.open(route, context, params);
} else { } else {