Less redundant freeing of resources on redirects
authorChris Adams <chris@improbable.org>
Sun, 29 Jan 2012 23:45:14 +0000 (18:45 -0500)
committerChris Adams <chris@improbable.org>
Sun, 29 Jan 2012 23:45:14 +0000 (18:45 -0500)
With 495646bb6a89802a60208c2ab09749edba1f8e51 the double flush is no longer
needed.

requests/models.py

index b4118b9..0647814 100644 (file)
@@ -210,6 +210,8 @@ class Request(object):
             while (('location' in r.headers) and
                    ((r.status_code is codes.see_other) or (self.allow_redirects))):
 
+                r.content  # Consume socket so it can be released
+
                 if not len(history) < self.config.get('max_redirects'):
                     raise TooManyRedirects()