diff options
Diffstat (limited to 'wsgitools')
-rw-r--r-- | wsgitools/digest.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/wsgitools/digest.py b/wsgitools/digest.py index c98517f..628eac5 100644 --- a/wsgitools/digest.py +++ b/wsgitools/digest.py @@ -703,13 +703,13 @@ class AuthDigestMiddleware(AuthenticationMiddleware): raise AuthenticationRequired("wrong response") environ["REMOTE_USER"] = credentials["username"] + digest = dict(nextnonce=self.noncestore.newnonce()) + if "qop" in credentials: + digest["qop"] = "auth" + digest["cnonce"] = credentials["cnonce"] # no KeyError + digest["rspauth"] = self.auth_response(credentials, "") + challenge = ", ".join(map('%s="%s"'.__mod__, digest.items())) def modified_start_response(status, headers, exc_info=None): - digest = dict(nextnonce=self.noncestore.newnonce()) - if "qop" in credentials: - digest["qop"] = "auth" - digest["cnonce"] = credentials["cnonce"] # no KeyError - digest["rspauth"] = self.auth_response(credentials, "") - challenge = ", ".join(map('%s="%s"'.__mod__, digest.items())) headers.append(("Authentication-Info", challenge)) return start_response(status, headers, exc_info) return self.app(environ, modified_start_response) |