This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urllib2's HTTPPasswordMgr and uri's with port numbers
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jhylton Nosy List: akrherz, fresh, jhylton
Priority: normal Keywords:

Created on 2004-06-17 14:09 by fresh, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg21209 - (view) Author: Chris Withers (fresh) Date: 2004-06-17 14:09
Python 2.3.3

The title just about sums it up.
If you add a password with a uri containing a port
number using add_password, then it probably won't be
returned by find_user_password.

That's not right ;-)
msg21210 - (view) Author: Chris Withers (fresh) Date: 2004-11-05 10:08
Logged In: YES 
user_id=24723

This patch fixes it for me:

--- urllib2.py.cvs      Fri Nov 05 10:02:26 2004
+++ urllib2.py.new      Fri Nov 05 10:05:48 2004
@@ -720,7 +720,7 @@
                     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)
+        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()
msg21211 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2004-12-22 14:27
Logged In: YES 
user_id=31392

Fixed in rev 1.78 of urllib2
msg21212 - (view) Author: Daryl Herzmann (akrherz) Date: 2007-03-07 19:27
Just for anybody like me stumbling into this.  It isn't fixed in python 2.4.3 and 
only works in python 2.5 .  Another reason to upgrade :)
History
Date User Action Args
2022-04-11 14:56:04adminsetgithub: 40412
2004-06-17 14:09:59freshcreate