You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2009/06/01 12:39:06 UTC

svn commit: r780611 - in /httpcomponents/httpclient/trunk: RELEASE_NOTES.txt httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java

Author: olegk
Date: Mon Jun  1 10:39:05 2009
New Revision: 780611

URL: http://svn.apache.org/viewvc?rev=780611&view=rev
Log:
HTTPCLIENT-852: Fixed bug causing automatically retried redirects fail with CircularRedirectException  

Modified:
    httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java

Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=780611&r1=780610&r2=780611&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Mon Jun  1 10:39:05 2009
@@ -1,6 +1,10 @@
 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 
   preceding a valid HTTP response.
   Contributed by Oleg Kalnichevski <olegk at apache.org>

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java?rev=780611&r1=780610&r2=780611&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java Mon Jun  1 10:39:05 2009
@@ -333,9 +333,9 @@
         int execCount = 0;
         
         boolean reuse = false;
-        HttpResponse response = null;
         boolean done = false;
         try {
+            HttpResponse response = null;
             while (!done) {
                 // In this loop, the RoutedRequest may be replaced by a
                 // followup request and route. The request and route passed
@@ -344,6 +344,7 @@
 
                 RequestWrapper wrapper = roureq.getRequest();
                 HttpRoute route = roureq.getRoute();
+                response = null;
                 
                 // See if we have a user token bound to the execution context
                 Object userToken = context.getAttribute(ClientContext.USER_TOKEN);
@@ -471,7 +472,7 @@
 
                         // If we have a direct route to the target host
                         // just re-open connection and re-try the request
-                        if (route.getHopCount() == 1) {
+                        if (!route.isTunnelled()) {
                             this.log.debug("Reopening the direct connection.");
                             managedConn.open(route, context, params);
                         } else {