ImageImage

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: Python 2.0b1, Win2K - urllib failure
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: effbot Nosy List: effbot, gvanrossum
Priority: normal Keywords:

Created on 2000-09-12 16:16 by anonymous, last changed 2022-04-10 16:02 by admin. This issue is now closed.

Messages (4)
msg1340 - (view) Author: Nobody/Anonymous (nobody) Date: 2000-09-12 16:16
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
[email protected]
msg1341 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2000-09-24 18:51
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.
msg1342 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-10-01 04:35
Fredrik, can you fix the code right or assign it to someone else who can? Or decide to close the bug report after all.
msg1343 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2000-10-03 15:03
Okay, I've failed to find case for which the new code
doesn't work, so let's close this one.
History
Date User Action Args
2022-04-10 16:02:22adminsetgithub: 33092
2000-09-12 16:16:44anonymouscreate