[issue754016] urlparse goes wrong with IP:port without scheme

Senthil report at bugs.python.org
Tue Jun 10 04:54:28 CEST 2008


Senthil <orsenthil at users.sourceforge.net> added the comment:

Attaching the patch to fix this issue. I deliberated upon this for a
while and came up with the approach to:

1) fix the port issue, wherein urlparse should technically recognize the 
':' separator for port from ':' after scheme.

2) And Doc fix wherein, it is advised that in the absence of a scheme,
use the net_loc as //net_loc (following RCF 1808).

If we go for any other fix, like internally pre-pending // when user has
not specified the scheme (like in many pratical purpose), then we stand
at chance of breaking a number of tests ( cases where url is 'g'(path
only),';x' (path with params) and cases where relative url is g:h)

Let me know your thoughts on this.

>>> urlparse('1.2.3.4:80')
ParseResult(scheme='', netloc='', path='1.2.3.4:80', params='',
query='', fragment='')
>>> urlparse('http://www.python.org:80/~guido/foo?query#fun')
ParseResult(scheme='http', netloc='www.python.org:80',
path='/~guido/foo', params='', query='query', fragment='fun')
>>>

----------
keywords: +patch
nosy: +orsenthil
Added file: http://bugs.python.org/file10570/issue754016.patch

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


More information about the Python-bugs-list mailing list