Skip to content
Myr

missing algorithm field

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

authored by Juan Riaza · committed by Juan Riaza · parent 47aa968 · Browse files · 1 file+10 added−6 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+10 added−6 removed

  • other:+10 added−6 removed

1 file+10 added−6 removed

modified:requests/auth.py+10 added-6 removed
66 unmodified lines
6768 realm = self.chal['realm']69 nonce = self.chal['nonce']70 qop = self.chal.get('qop')71 algorithm = self.chal.get('algorithm', 'MD5')72 opaque = self.chal.get('opaque', None)71 algorithm = self.chal.get('algorithm')72 opaque = self.chal.get('opaque')7374 if algorithm is None:75 _algorithm = 'MD5'76 else:74 algorithm = algorithm.upper()77 _algorithm = algorithm.upper()78 # lambdas assume digest modules are imported at the top level76 if algorithm == 'MD5':79 if _algorithm == 'MD5':80 def md5_utf8(x):81 if isinstance(x, str):82 x = x.encode('utf-8')83 return hashlib.md5(x).hexdigest()84 hash_utf8 = md5_utf882 elif algorithm == 'SHA':85 elif _algorithm == 'SHA':86 def sha_utf8(x):87 if isinstance(x, str):88 x = x.encode('utf-8')89 return hashlib.sha1(x).hexdigest()
41 unmodified lines
131 base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \132 'response="%s"' % (self.username, realm, nonce, path, respdig)133 if opaque:134 base += ', opaque="%s"' % opaque135 if algorithm:136 base += ', algorithm="%s"' % algorithm137 if entdig:138 base += ', digest="%s"' % entdig134 base += ', algorithm="%s"' % algorithm139 if qop:140 base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)141142 return 'Digest %s' % (base)
30 unmodified lines