summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2014-09-07 12:02:23 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2014-09-07 12:02:23 -0500
commit27c83f71770a2a64d56b7d53f9cc67f53cf70ccd (patch)
tree154a57578ed80a88af26dd352c7daf8849ce39fb
parent359659cf4b9dbeeef1ed832501dc1f99b0f0beac (diff)
downloadpython-requests-27c83f71770a2a64d56b7d53f9cc67f53cf70ccd.tar.gz
Fix #2207
@Lukasa wrote the fix in #2207
-rw-r--r--requests/sessions.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/requests/sessions.py b/requests/sessions.py
index 334db58e..023edfbd 100644
--- a/requests/sessions.py
+++ b/requests/sessions.py
@@ -134,8 +134,8 @@ class SessionRedirectMixin(object):
url = requote_uri(url)
prepared_request.url = to_native_string(url)
- # cache the url
- if resp.is_permanent_redirect:
+ # Cache the url, unless it redirects to itself.
+ if resp.is_permanent_redirect and req.url != prepared_request.url:
self.redirect_cache[req.url] = prepared_request.url
# http://tools.ietf.org/html/rfc7231#section-6.4.4