summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCory Benfield <lukasaoz@gmail.com>2014-09-09 15:24:24 +0100
committerCory Benfield <lukasaoz@gmail.com>2014-09-09 15:24:24 +0100
commit5e94c81e98168e79cb4e46e27a7630e94e785cec (patch)
treee6d1a812b2d767596e2cdd851e7c3b4da8c3995d
parent2416e2343aa6e06dc75f36b51a7e9bfa7bd28d85 (diff)
parent27c83f71770a2a64d56b7d53f9cc67f53cf70ccd (diff)
downloadpython-requests-5e94c81e98168e79cb4e46e27a7630e94e785cec.tar.gz
Merge pull request #2210 from sigmavirus24/bug/2207
Fix #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