From 730c0e2e2bef77968a86962f9d5f2bebba4d19ec Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Sun, 29 Jan 2012 17:31:57 -0500 Subject: [PATCH] Initial stop-the-bleeding fix This is redundant but it avoids crashing otherwise working code. The code-smell from duplication suggests that this interface should be refactored slightly. --- requests/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requests/models.py b/requests/models.py index b4118b93..770e9b04 100644 --- a/requests/models.py +++ b/requests/models.py @@ -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() @@ -262,6 +264,7 @@ class Request(object): self.cookies.update(r.cookies) r.history = history + r.content # Consume socket so it can be released self.response = r self.response.request = self