def respond(self): data = { 'username': quote(self.credentials['username']), 'authzid': quote(self.credentials['authzid']), 'realm': quote(self.credentials['realm']), 'nonce': quote(self.nonce), 'cnonce': quote(self.cnonce), 'nc': bytes('%08x' % self.nonce_count), 'qop': self.qop, 'digest-uri': quote(self.digest_uri()), 'response': self.response(b'AUTHENTICATE'), 'maxbuf': self.maxbuf } resp = b'' for key, value in data.items(): if value and value != b'""': resp += b',' + bytes(key) + b'=' + bytes(value) return resp[1:]
def respond(self): data = { "username": quote(self.credentials["username"]), "authzid": quote(self.credentials["authzid"]), "realm": quote(self.credentials["realm"]), "nonce": quote(self.nonce), "cnonce": quote(self.cnonce), "nc": bytes("%08x" % self.nonce_count), "qop": self.qop, "digest-uri": quote(self.digest_uri()), "response": self.response(b"AUTHENTICATE"), "maxbuf": self.maxbuf, "charset": "utf-8", } resp = b"" for key, value in data.items(): if value and value != b'""': resp += b"," + bytes(key) + b"=" + bytes(value) return resp[1:]