From: Akira Kitada Date: Wed, 12 Nov 2014 14:46:22 +0000 (+0900) Subject: Fix HTTPDigestAuth not to treat non-file as a file X-Git-Tag: v2.5.0~10^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67c505781cece96763b86c47967efb785f33b079;p=services%2Fpython-requests.git 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. --- diff --git a/requests/auth.py b/requests/auth.py index 010919f..618a902 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