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.

Title: urllib2.HTTPBasicAuthHandler problem with [HOST]:[PORT]
Type: Stage:
Components: Extension Modules Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, mmzeeman, o-zone2004
Priority: normal Keywords:

Created on 2004-11-29 18:06 by o-zone2004, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg23364 - (view) Author: O-Zone (o-zone2004) Date: 2004-11-29 18:06
I've encountered problems authenticating to an host
with this piece of code:

       passman =
        passman.add_password(None, theurl, username,
        authhandler =
        opener = urllib2.build_opener(authhandler)    
        req = urllib2.Request(theurl)
            handle = urllib2.urlopen(req)

if i specify an URL like: http://[MyHostIP]:[Port] auth
helper never authorize me on the host. 

It work perfectly if i don't specify ANY port in the URL.

Regards, Michele "O-Zone" Pinassi
msg23365 - (view) Author: MM Zeeman (mmzeeman) Date: 2004-12-09 10:33
Logged In: YES 

This is actually the same problem as reported in bug 974757,
which has a 
patch attached to it. 

The problem is that with basic authentication only the 
hostname + portnumber is passed to find_user_password. This
works if there is no port number when a netloc is used. 

It looks like the answer from reduce_uri is wrong when port
numbers are used.

msg23366 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-02-20 21:02
Logged In: YES 

Closing, as the patch #974757 was committed.
Date User Action Args
2022-04-11 14:56:08adminsetgithub: 41244
2004-11-29 18:06:02o-zone2004create