[New-bugs-announce] [issue2195] urlparse()

Gawain Bolton report at bugs.python.org
Tue Feb 26 23:31:54 CET 2008

New submission from Gawain Bolton:

The urlparse() function in urlparse module does not handle URLs without 
an explicit scheme and with port numbers.

The following works as expected:
>>> urlparse.urlparse('foo.bar.com','http').scheme

But if the URL has a port number then the scheme is wrong:
>>> urlparse.urlparse('foo.bar.com:8080','http').scheme

I have read RFC 1808 and its description of the parsing of the scheme 
also has this bug.  From what I can figure, the parsing algorithm needs 
to search for the scheme before the substring "://" and not just ":".

components: Library (Lib)
messages: 63054
nosy: gawain
severity: normal
status: open
title: urlparse()
type: behavior
versions: Python 2.5

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list