[issue10860] urllib2 crashes on valid URL

Senthil Kumaran report at bugs.python.org
Sat Jan 8 09:11:40 CET 2011


Senthil Kumaran <orsenthil at gmail.com> added the comment:

On Fri, Jan 07, 2011 at 07:14:30PM +0000, Shawn Ligocki wrote:
> 
> I think the problem is that "http://118114.cn" says it redirects to
> "http://www.118114.cn:", but it seems like urllib2 should be able to
> deal with that or at least report back a more useful error message.

I think, this is improper at the Server End to redirect it to URL
where ':' is provided and Port is missing.

Any client, which does a transparent redirection, can be expected to fail.

senthil at rubuntu:~$ curl -L http://118114.cn
curl: (6) Couldn't resolve host 'www.118114.cn:'

The Redirected URL is an Invalid Syntax and I don't think we should
fix by providing a default port at urllib2 end. What can be done is
fail with timeout or raise an Exception for an Invalid URL.

----------
title: Handle empty port after port delimiter in httplib -> urllib2 crashes on valid URL

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10860>
_______________________________________


More information about the Python-bugs-list mailing list