Skip to content
Myr

Merge pull request #1766 from Lukasa/qop

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Quote qop values in digest auth.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 5c91545, 92d3616 · Browse files · 2 files+10 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−2 removed

  • other:+10 added−2 removed

2 files+10 added−2 removed

modified:requests/auth.py+2 added-2 removed
103 unmodified lines
104 path += '?' + p_parsed.query105106 A1 = '%s:%s:%s' % (self.username, realm, self.password)107 A2 = '%s:%s' % (method, path)108 108109 HA1 = hash_utf8(A1)110 HA2 = hash_utf8(A2)111112 if nonce == self.last_nonce:
30 unmodified lines
143 base += ', algorithm="%s"' % algorithm144 if entdig:145 base += ', digest="%s"' % entdig146 if qop:147 base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)147 base += ', qop="auth", nc=%s, cnonce="%s"' % (ncvalue, cnonce)148149 return 'Digest %s' % (base)150151 def handle_401(self, r, **kwargs):
43 unmodified lines
modified:test_requests.py+8 added
326 unmodified lines
327 s.auth = auth328 r = s.get(url)329 assert r.status_code == 401330331 def test_DIGESTAUTH_QUOTES_QOP_VALUE(self):332333 auth = HTTPDigestAuth('user', 'pass')334 url = httpbin('digest-auth', 'auth', 'user', 'pass')335336 r = requests.get(url, auth=auth)337 assert '"auth"' in r.request.headers['Authorization']338339 def test_POSTBIN_GET_POST_FILES(self):340341 url = httpbin('post')342 post1 = requests.post(url).raise_for_status()
607 unmodified lines