[New-bugs-announce] [issue28841] urlparse.urlparse() parses invalid URI without generating an error (examples provided)

Amrith Kumar report at bugs.python.org
Wed Nov 30 10:57:05 EST 2016


New submission from Amrith Kumar:

The urlparse library incorrectly accepts a URI which specifies an invalid host identifier.

Example:

http://www.example.com:/abc

Looking at the URI specifications, this is an invalid URI.

By definition, you are supposed to specify a "hostport" and a hostport is defined as:

https://www.w3.org/Addressing/URL/uri-spec.html

hostport
    host [ : port ]

The BNF indicates that : is only valid if a port is also specified.

See current behavior; I submit to you that this should generate an exception.

https://gist.github.com/anonymous/8504f160ff90649890b5a2a82f8028b0

----------
components: Library (Lib)
messages: 282086
nosy: amrith
priority: normal
severity: normal
status: open
title: urlparse.urlparse() parses invalid URI without generating an error (examples provided)
type: behavior
versions: Python 2.7, Python 3.4

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


More information about the New-bugs-announce mailing list