[Python-bugs-list] Fwd: Debian Bug#42318: urllib.py has problems with malformed proxy env. variables (PR#59)

flight@debian.org flight@debian.org
Fri, 20 Aug 1999 13:40:05 -0400 (EDT)

Full_Name: Gregor Hoffleit
Version: 1.5.2
OS: Debian potato
Submission from: testserv.mathi.uni-heidelberg.de (

Summary: Python's urllib expects a fully qualified URL in HTTP_PROXY (like
"http://proxy:8080/"). Many applications allow short forms in HTTP_PROXY
(like "proxy:8080"). If HTTP_PROXY is set to a short form, urllib.py will
fail with an uncomprehensible error message.

Long form:

Francesco Potorti` <F.Potorti@cnuce.cnr.it> says (in the Debian bug report

  "when setting a proxy variable that is not parsed by urllib, urllib does
   not print a comprehensible error message."

An example:

Short form HTTP_PROXY:

  master% HTTP_PROXY="proxy.cnr.it:8081" \
    python -c 'import urllib; print
  Traceback (innermost last):
    File "<string>", line 1, in ?
    File "/usr/lib/python1.5/urllib.py", line 69, in urlretrieve
      return _urlopener.retrieve(url)
    File "/usr/lib/python1.5/urllib.py", line 186, in retrieve
      fp = self.open(url)
    File "/usr/lib/python1.5/urllib.py", line 154, in open
      return self.open_unknown(fullurl)
    File "/usr/lib/python1.5/urllib.py", line 168, in open_unknown
      raise IOError, ('url error', 'unknown url type', type)
  IOError: ('url error', 'unknown url type', 'http')

Fully qualified URL in HTTP_PROXY:

  master% HTTP_PROXY="http://proxy.cnr.it:8081" \
    python -c 'import urllib; print
  ('/tmp/@15884.1', <mimetools.Message instance at 80adb08>)