[ python-Bugs-902075 ] urllib2 should be more robust for sloppy proxy URLs

SourceForge.net noreply at sourceforge.net
Sat Jan 21 08:22:05 CET 2006


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

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Matthias Klose (doko)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2 should be more robust for sloppy proxy URLs

Initial Comment:
passing an URL like "foo.bar.baz" instead of
"http://foo.bar.baz" results in a stacktrace:

  File "/usr/lib/python2.3/urllib2.py", line 326, in open
    '_open', req)
  File "/usr/lib/python2.3/urllib2.py", line 306, in
_call_chain
    result = func(*args)
  File "/usr/lib/python2.3/urllib2.py", line 491, in
<lambda>
    lambda r, proxy=url, type=type, meth=self.proxy_open: \
  File "/usr/lib/python2.3/urllib2.py", line 498, in
proxy_open
    if '@' in host:
TypeError: iterable argument required

This could be fixed by calling urlparse.urlparse on the
proxy url, either in the calling code or in the library
code, which I would prefer to make it more robust about
sloppy URLs passed in the http_proxy environment variable.


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

>Comment By: Georg Brandl (birkenfeld)
Date: 2006-01-21 08:22

Message:
Logged In: YES 
user_id=1188172

I committed a fix (similar to the patch) in rev. 42133 to
the HEAD.

I'm not sure whether to backport.

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

Comment By: Andrew Bennetts (spiv)
Date: 2006-01-17 04:04

Message:
Logged In: YES 
user_id=50945

I think test cases would help the patch at
http://bugs.debian.org/233305 get applied.

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

Comment By: Chris Lawrence (lordsutch)
Date: 2004-03-24 22:51

Message:
Logged In: YES 
user_id=6757

I've put together a patch, which can be found at
http://bugs.debian.org/233305; it isn't perfect (ideally the
entire routine should be rewritten, as it's processing
environment data that could be from the "wild"), but it
avoids the traceback.

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

Comment By: Matthias Klose (doko)
Date: 2004-02-22 11:19

Message:
Logged In: YES 
user_id=60903

Ok, I see, PEP42 ...


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

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


More information about the Python-bugs-list mailing list