Encode HA2() string parameters 'method', 'uri' and 'H(entityBody)'

This fixes error 500, when httpbin is run with python3 and digest-auth is attempted with qop='auth-int'.
This commit is contained in:
Felix Palta
2016-12-04 21:33:54 +03:00
parent 45058da872
commit e7e9163625
+4 -3
View File
@@ -292,9 +292,10 @@ def HA2(credentails, request, algorithm):
for k in 'method', 'uri', 'body':
if k not in request:
raise ValueError("%s required" % k)
return H("%s:%s:%s" % (request['method'],
request['uri'],
H(request['body'], algorithm)), algorithm)
A2 = b":".join([request['method'].encode('utf-8'),
request['uri'].encode('utf-8'),
H(request['body'], algorithm).encode('utf-8')])
return H(A2, algorithm)
raise ValueError