Redirect history fix (Closes #91)
authorKenneth Reitz <me@kennethreitz.com>
Sun, 24 Jul 2011 02:11:54 +0000 (22:11 -0400)
committerKenneth Reitz <me@kennethreitz.com>
Sun, 24 Jul 2011 02:11:54 +0000 (22:11 -0400)
requests/models.py

index 289546c..05623ec 100644 (file)
@@ -170,10 +170,7 @@ class Request(object):
 
         r = build(resp)
 
-        if r.status_code in REDIRECT_STATI:
-            self.redirect = True
-
-        if self.redirect:
+        if r.status_code in REDIRECT_STATI and not self.redirect:
 
             while (
                 ('location' in r.headers) and