[Python-bugs-list] [Bug #114256] Python 2.0b1, Win2K - urllib failure

noreply@sourceforge.net noreply@sourceforge.net
Sun, 24 Sep 2000 11:51:04 -0700


Bug #114256, was updated on 2000-Sep-12 09:16
Here is a current snapshot of the bug.

Project: Python
Category: Library
Status: Open
Resolution: Fixed
Bug Group: Platform-specific
Priority: 5
Summary: Python 2.0b1, Win2K - urllib failure

Details: This might be related to bug #110692, since it seems to be related to proxies.

A program I have that works under older versions of Python now fails with this traceback:


Traceback (most recent call last):
  File "IGNRatings.py", line 289, in ?
    main(sys.argv[1:])
  File "IGNRatings.py", line 133, in main
    inStream = urllib.urlopen(url)
  File "E:\Python20\lib\urllib.py", line 61, in urlopen
    return _urlopener.open(url)
  File "E:\Python20\lib\urllib.py", line 163, in open
    return getattr(self, name)(url)
  File "E:\Python20\lib\urllib.py", line 259, in open_http
    h = httplib.HTTP(host)
  File "E:\Python20\lib\httplib.py", line 624, in __init__
    self._conn = self._connection_class(host, port)
  File "E:\Python20\lib\httplib.py", line 324, in __init__
    self._set_hostport(host, port)
  File "E:\Python20\lib\httplib.py", line 330, in _set_hostport
    port = int(host[i+1:])
ValueError: invalid literal for int():


My URL is nothing special:

    'http://dreamcast.ign.com/review_lists/a.html'


I have tracked the problem down a bit:

In urllib.py, line 147, the statement

    proxy = self.proxies[type]

assigns the string

    'http://http://proxy:8080'

to "proxy". My guess is that's not right. Anyway, the following line assigns

    type = 'http'
    proxy = '//http://proxy:8080'

and the next line assigns

    host = 'http:'
    selector = '//proxy:8080'

'http:' as a host name then goes on to cause trouble when an HTTPConnection is constructed.

Hope this info helps you track it down.

Bob Alexander
bobalex@home.com

Follow-Ups:

Date: 2000-Sep-24 11:51
By: effbot

Comment:
Fixed in 2.0b2.

The earlier code assumed "protocol=host;protocol=host;..." or "host", but Windows may also use "protocol=host" (just one entry), as well as "protocol://host".  This code needs some more work, so I'll leave the bug open for now.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=114256&group_id=5470