[Python-checkins] python/dist/src/Lib urllib2.py,1.77,1.78
jhylton at users.sourceforge.net
jhylton at users.sourceforge.net
Wed Dec 22 15:27:22 CET 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10093/Lib
Modified Files:
urllib2.py
Log Message:
Two small changes, SF bug #974757 and SF patch #1037974.
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.
Index: urllib2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- urllib2.py 11 Oct 2004 13:53:07 -0000 1.77
+++ urllib2.py 22 Dec 2004 14:27:19 -0000 1.78
@@ -720,7 +720,10 @@
return self.retry_http_basic_auth(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:
raw = "%s:%s" % (user, pw)
auth = 'Basic %s' % base64.encodestring(raw).strip()
@@ -877,13 +880,12 @@
'response="%s"' % (user, realm, nonce, req.get_selector(),
respdig)
if opaque:
- base = base + ', opaque="%s"' % opaque
+ base += ', opaque="%s"' % opaque
if entdig:
- base = base + ', digest="%s"' % entdig
- if algorithm != 'MD5':
- base = base + ', algorithm="%s"' % algorithm
+ base += ', digest="%s"' % entdig
+ base += ', algorithm="%s"' % algorithm
if qop:
- base = base + ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)
+ base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)
return base
def get_algorithm_impls(self, algorithm):
More information about the Python-checkins
mailing list