Skip to content
Myr

Fix HTTPDigestAuth not to treat non-file as a file

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Ensure pos is set to None when the body is not a file so that HTTPDigestAuth detects the type of the body correctly.

authored by Akira Kitada · committed by Akira Kitada · parent 431282e · Browse files · 1 file+5 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−1 removed

  • other:+5 added−1 removed

1 file+5 added−1 removed

modified:requests/auth.py+5 added-1 removed
196 unmodified lines
197 r.headers['Authorization'] = self.build_digest_header(r.method, r.url)198 try:199 self.pos = r.body.tell()200 except AttributeError:201 pass201 # In the case of HTTPDigestAuth being reused and the body of202 # the previous request was a file-like object, pos has the203 # file position of the previous body. Ensure it's set to204 # None.205 self.pos = None206 r.register_hook('response', self.handle_401)207 r.register_hook('response', self.handle_redirect)208 return r