A1 = '%s:%s:%s' % (self.username, realm, self.password)
A2 = '%s:%s' % (method, path)
-
+
HA1 = hash_utf8(A1)
HA2 = hash_utf8(A2)
if entdig:
base += ', digest="%s"' % entdig
if qop:
- base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)
+ base += ', qop="auth", nc=%s, cnonce="%s"' % (ncvalue, cnonce)
return 'Digest %s' % (base)
r = s.get(url)
assert r.status_code == 401
+ def test_DIGESTAUTH_QUOTES_QOP_VALUE(self):
+
+ auth = HTTPDigestAuth('user', 'pass')
+ url = httpbin('digest-auth', 'auth', 'user', 'pass')
+
+ r = requests.get(url, auth=auth)
+ assert '"auth"' in r.request.headers['Authorization']
+
def test_POSTBIN_GET_POST_FILES(self):
url = httpbin('post')