From 79ac8a24be0513a64d0049763a412a9cfd16d9a4 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Tue, 14 Oct 2008 13:57:14 +0200 Subject: small digest cleanup --- wsgitools/digest.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'wsgitools/digest.py') 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""" -- cgit v1.2.3