[ python-Bugs-1075427 ] urllib2.HTTPBasicAuthHandler problem with [HOST]:[PORT]

SourceForge.net noreply at sourceforge.net
Thu Dec 9 11:33:06 CET 2004


Bugs item #1075427, was opened at 2004-11-29 19:06
Message generated for change (Comment added) made by mmzeeman
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1075427&group_id=5470

Category: Extension Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: O-Zone (o-zone2004)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2.HTTPBasicAuthHandler problem with [HOST]:[PORT]

Initial Comment:
I've encountered problems authenticating to an host
with this piece of code:

       passman =
urllib2.HTTPPasswordMgrWithDefaultRealm()      
        passman.add_password(None, theurl, username,
password)      
        authhandler =
urllib2.HTTPBasicAuthHandler(passman)                 
        opener = urllib2.build_opener(authhandler)    
                             
        urllib2.install_opener(opener)
        req = urllib2.Request(theurl)
        try:
            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

----------------------------------------------------------------------

Comment By: MM Zeeman (mmzeeman)
Date: 2004-12-09 11:33

Message:
Logged In: YES 
user_id=350634

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
method 
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.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1075427&group_id=5470


More information about the Python-bugs-list mailing list