New submission from Hans Ulrich Niedermann <[EMAIL PROTECTED]>:

The urlparse module's ways of splitting the location into hostname and
port breaks with RFC2732 style URIs with IPv6 addresses in them:

>>> import urlparse
>>> urlparse.urlparse('http://[::1]:80/').hostname
'['
>>> urlparse.urlparse('http://[::1]:80/').port
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/urlparse.py", line 116, in port
    return int(port, 10)
ValueError: invalid literal for int() with base 10: ':1]:80'
>>> 

A simple fix is attached, but probably requires a little more thought.

----------
components: Library (Lib)
files: python-urlparse-rfc2732-fix.patch
keywords: patch
messages: 67430
nosy: ndim
severity: normal
status: open
title: RFC2732 support for urlparse (e.g. http://[::1]:80/)
type: feature request
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file10451/python-urlparse-rfc2732-fix.patch

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2987>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to