Permalink
Browse files

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'.
  • Loading branch information...
1 parent 45058da commit e7e9163625670d750540deaa9764b6a1ac51c6ab @felixpalta felixpalta committed Dec 4, 2016
Showing with 4 additions and 3 deletions.
  1. +4 −3 httpbin/helpers.py
View
@@ -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

0 comments on commit e7e9163

Please sign in to comment.