Package: python2.3
Version: 2.3.5-2
Severity: normal

(same bug seems to hold for python 2.4.1 as well)

I was trying to implement a basic HTTP client using HTTP basic
authorization. The current preferred method of doing this is by using
urllib2 HTTPPasswordMgr. 

A simple test snippet to try this:

pwmgr=urllib2.HTTPPasswordMgrWithDefaultRealm()
pwmgr.add_password(None, url, username, password)
handler=urllib2.HTTPBasicAuthHandler(pwmgr)
opener=urllib2.build_opener(handler)
urllib2.install_opener(opener)
u=urllib2.urlopen(url)

This did not work. Modifying the second line to:

pwmgr.add_password(None, urlparse.urlparse(url)[1], username, password)

fixed things, which shows a problem in the documentation: instead of
a URI or sequence of URIs the add_password method takes a hostname. 

The documented behaviour would be better since it allows for multiple
passwords per host, although in reality those will use different realms.
So I suggest not changing the code in order to not break existing
application but fixing the documentation instead.

Wichert.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.11.7
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages python2.3 depends on:
ii  libbz2-1.0                  1.0.2-5      high-quality block-sorting file co
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libdb4.2                    4.2.52-18    Berkeley v4.2 Database Libraries [
ii  libncurses5                 5.4-4        Shared libraries for terminal hand
ii  libreadline4                4.3-15       GNU readline and history libraries
ii  libssl0.9.7                 0.9.7e-3     SSL shared libraries
ii  zlib1g                      1:1.2.2-4    compression library - runtime

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to