GH-162: No 500 w/ better handle missing dict keys

This commit is contained in:
Marc Abramowitz
2014-11-29 00:03:29 -08:00
parent 128bc1b986
commit 3c40fab03b
+2 -2
View File
@@ -297,7 +297,7 @@ def response(credentails, password, request):
if credentails.get('qop') is None:
response = H(b":".join([
HA1_value.encode('utf-8'),
credentails.get('nonce').encode('utf-8'),
credentails.get('nonce', '').encode('utf-8'),
HA2_value.encode('utf-8')
]))
elif credentails.get('qop') == 'auth' or credentails.get('qop') == 'auth-int':
@@ -326,6 +326,6 @@ def check_digest_auth(user, passwd):
response_hash = response(credentails, passwd, dict(uri=request.path,
body=request.data,
method=request.method))
if credentails['response'] == response_hash:
if credentails.get('response') == response_hash:
return True
return False