Pass the full URL to find_user_password(), in particular so that hosts with port numbers can be looked up. Also specify the digest algorithm, even if it's MD5. Titus Brown verified that this fixes a problem with LiveJournal.
This commit is contained in:
parent
6414cd8717
commit
b300ae3a79
|
@ -720,7 +720,10 @@ class AbstractBasicAuthHandler:
|
||||||
return self.retry_http_basic_auth(host, req, realm)
|
return self.retry_http_basic_auth(host, req, realm)
|
||||||
|
|
||||||
def retry_http_basic_auth(self, host, req, realm):
|
def retry_http_basic_auth(self, host, req, realm):
|
||||||
user,pw = self.passwd.find_user_password(realm, host)
|
# TODO(jhylton): Remove the host argument? It depends on whether
|
||||||
|
# retry_http_basic_auth() is consider part of the public API.
|
||||||
|
# It probably is.
|
||||||
|
user, pw = self.passwd.find_user_password(realm, req.get_full_url())
|
||||||
if pw is not None:
|
if pw is not None:
|
||||||
raw = "%s:%s" % (user, pw)
|
raw = "%s:%s" % (user, pw)
|
||||||
auth = 'Basic %s' % base64.encodestring(raw).strip()
|
auth = 'Basic %s' % base64.encodestring(raw).strip()
|
||||||
|
@ -877,13 +880,12 @@ class AbstractDigestAuthHandler:
|
||||||
'response="%s"' % (user, realm, nonce, req.get_selector(),
|
'response="%s"' % (user, realm, nonce, req.get_selector(),
|
||||||
respdig)
|
respdig)
|
||||||
if opaque:
|
if opaque:
|
||||||
base = base + ', opaque="%s"' % opaque
|
base += ', opaque="%s"' % opaque
|
||||||
if entdig:
|
if entdig:
|
||||||
base = base + ', digest="%s"' % entdig
|
base += ', digest="%s"' % entdig
|
||||||
if algorithm != 'MD5':
|
base += ', algorithm="%s"' % algorithm
|
||||||
base = base + ', algorithm="%s"' % algorithm
|
|
||||||
if qop:
|
if qop:
|
||||||
base = base + ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)
|
base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)
|
||||||
return base
|
return base
|
||||||
|
|
||||||
def get_algorithm_impls(self, algorithm):
|
def get_algorithm_impls(self, algorithm):
|
||||||
|
|
Loading…
Reference in New Issue