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.
This commit is contained in:
Akira Kitada
2014-11-12 23:46:22 +09:00
parent 431282e778
commit 67c505781c
+5 -1
View File
@@ -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