summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Cordasco <icordasc+github@coglib.com>2014-11-12 09:53:32 -0600
committerIan Cordasco <icordasc+github@coglib.com>2014-11-12 09:53:32 -0600
commit19b8e3042e8bd5abf4da2464ac3b45551f88e292 (patch)
tree18fb98942c86d4568d5acc4c510981d2d0d8c322
parent431282e77888e6601991d8c1e2481b3692f4194a (diff)
parent67c505781cece96763b86c47967efb785f33b079 (diff)
downloadpython-requests-19b8e3042e8bd5abf4da2464ac3b45551f88e292.tar.gz
Merge pull request #2333 from akitada/reinit-pos
Fix HTTPDigestAuth not to treat non-file as a file
-rw-r--r--requests/auth.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/requests/auth.py b/requests/auth.py
index 010919f3..618a902a 100644
--- a/requests/auth.py
+++ b/requests/auth.py
@@ -198,7 +198,11 @@ class HTTPDigestAuth(AuthBase):
try:
self.pos = r.body.tell()
except AttributeError:
- pass
+ # In the case of HTTPDigestAuth being reused and the body of
+ # the previous request was a file-like object, pos has the
+ # file position of the previous body. Ensure it's set to
+ # None.
+ self.pos = None
r.register_hook('response', self.handle_401)
r.register_hook('response', self.handle_redirect)
return r