diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-03-06 14:17:47 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-03-06 14:17:47 (GMT) |
commit | 48238c7e373aed6bf0f246b6c0887827397ae5ce (patch) | |
tree | 1644dbb0d394672ce5b7e44b0cb30c82835114de /Lib/urllib/request.py | |
parent | 656e41ec67befb2377be0bae6e1e0fca31413f9c (diff) | |
parent | e88dd1c32c2961e0fe40b09c48904451fa1eba9a (diff) | |
download | cpython-48238c7e373aed6bf0f246b6c0887827397ae5ce.zip cpython-48238c7e373aed6bf0f246b6c0887827397ae5ce.tar.gz cpython-48238c7e373aed6bf0f246b6c0887827397ae5ce.tar.bz2 |
Issue #2202: Fix UnboundLocalError in AbstractDigestAuthHandler.get_algorithm_impls
Raise ValueError if algorithm is not MD5 or SHA.
Initial patch by Mathieu Dupuy.
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r-- | Lib/urllib/request.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index e3eed16..909c2cf 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1171,6 +1171,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 |