mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Issue #2202: Fix UnboundLocalError in AbstractDigestAuthHandler.get_algorithm_impls
Raise ValueError if algorithm is not MD5 or SHA. Initial patch by Mathieu Dupuy.
This commit is contained in:
parent
8cc859c103
commit
e88dd1c32c
3 changed files with 17 additions and 1 deletions
|
@ -1111,6 +1111,9 @@ class AbstractDigestAuthHandler:
|
|||
elif algorithm == 'SHA':
|
||||
H = lambda x: hashlib.sha1(x.encode("ascii")).hexdigest()
|
||||
# XXX MD5-sess
|
||||
else:
|
||||
raise ValueError("Unsupported digest authentication "
|
||||
"algorithm %r" % algorithm)
|
||||
KD = lambda s, d: H("%s:%s" % (s, d))
|
||||
return H, KD
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue