Skip to content
Myr

A fix for #1979 repeat HTTP digest authentication after redirect.

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

authored by Yossi Gottlieb · committed by Yossi Gottlieb · parent a718a81 · Browse files · 1 file+9 added−0 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+9 added−0 removed

  • other:+9 added−0 removed

1 file+9 added−0 removed

modified:requests/auth.py+9 added
148 unmodified lines
149 base += ', qop="auth", nc=%s, cnonce="%s"' % (ncvalue, cnonce)150151 return 'Digest %s' % (base)152153 def handle_302(self, r, **kwargs):154 """Reset num_401_calls counter on redirects."""155 try:156 delattr(self, 'num_401_calls')157 except AttributeError:158 pass159 return r160161 def handle_401(self, r, **kwargs):162 """Takes the given response and tries digest-auth, if needed."""163164 if self.pos is not None:
36 unmodified lines
201 self.pos = r.body.tell()202 except AttributeError:203 pass204 r.register_hook('response', self.handle_401)205 r.register_hook('response', self.handle_302)206 return r