diff options
author | Akira Kitada <akitada@gmail.com> | 2014-11-12 23:46:22 +0900 |
---|---|---|
committer | Akira Kitada <akitada@gmail.com> | 2014-11-13 00:51:35 +0900 |
commit | 67c505781cece96763b86c47967efb785f33b079 (patch) | |
tree | 18fb98942c86d4568d5acc4c510981d2d0d8c322 | |
parent | 431282e77888e6601991d8c1e2481b3692f4194a (diff) | |
download | python-requests-67c505781cece96763b86c47967efb785f33b079.tar.gz |
Fix HTTPDigestAuth not to treat non-file as a file
Ensure pos is set to None when the body is not a file
so that HTTPDigestAuth detects the type of the body correctly.
-rw-r--r-- | requests/auth.py | 6 |
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 |