From: Jamshid Afshar Date: Wed, 12 Dec 2012 00:14:13 +0000 (-0600) Subject: Issue #996 Location should not be followed unless 30X response. X-Git-Tag: v1.0.0~82^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=500dc7886712b1e2cb112b837769230544d88b1e;p=services%2Fpython-requests.git Issue #996 Location should not be followed unless 30X response. --- diff --git a/requests/models.py b/requests/models.py index 10c8587..9c768b5 100644 --- a/requests/models.py +++ b/requests/models.py @@ -233,7 +233,7 @@ class Request(object): if r.status_code in REDIRECT_STATI and not self.redirect: - while (('location' in r.headers) and + while (('location' in r.headers and r.status_code in REDIRECT_STATI) and ((r.status_code is codes.see_other) or (self.allow_redirects))): r.content # Consume socket so it can be released