summaryrefslogtreecommitdiff
path: root/wsgitools/digest.py
diff options
context:
space:
mode:
Diffstat (limited to 'wsgitools/digest.py')
-rwxr-xr-xwsgitools/digest.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/wsgitools/digest.py b/wsgitools/digest.py
index 1339fbb..d85ea39 100755
--- a/wsgitools/digest.py
+++ b/wsgitools/digest.py
@@ -433,19 +433,17 @@ class AuthDigestMiddleware:
a1h = self.gentoken(username, algo)
if a1h is None:
raise ValueError
- a2 = "%s:%s" % (reqmethod, uri)
- a2h = self.algorithms[algo](a2)
+ a2h = self.algorithms[algo]("%s:%s" % (reqmethod, uri))
qop = credentials.get("qop", None)
if qop is None:
dig = ":".join((a1h, nonce, a2h))
else:
- nc = credentials["nc"] # raises KeyError
- cnonce = credentials["cnonce"] # raises KeyError
if qop != "auth":
return ValueError
- dig = ":".join((a1h, nonce, nc, cnonce, qop, a2h))
- digh = self.algorithms[algo](dig)
- return digh
+ # raises KeyError
+ dig = ":".join((a1h, nonce, credentials["nc"],
+ credentials["cnonce"], qop, a2h))
+ return self.algorithms[algo](dig)
def authorization_required(self, environ, start_response, stale=False):
"""internal method implementing wsgi interface, serving 401 page"""