[issue2987] RFC2732 support for urlparse (IPv6 addresses)
R. David Murray
report at bugs.python.org
Sat Apr 17 22:44:53 CEST 2010
R. David Murray <rdmurray at bitdance.com> added the comment:
I don't know how deep you want to get into detecting invalid URIs, but with the new patch this one causes a parsing error that is probably worth dealing with:
http://abc[xyz]jkl
Maybe a reasonable set of checks would be (in hostname) that if the part of the netloc after the @ contains a ']' or a '[', then it must start with a [ and either end with a ] or contain a ']:'.
I can also mess up your new checks with something like this:
http://foo[bar@baz]
or even:
http://foo[bar@baz:33]
although those don't fail, they just faithfully produce the nonsensical results implicit in the invalid urls. I think the above check logic in hostname would catch them, but it wouldn't catch this one:
http://foo[bar@[bar]:33]
That may be OK, though, since as you noted earlier we aren't doing full URI validation.
Oh, and I notice that your test only covers the 'fast' path code, it doesn't exercise the general URI logic.
(Sorry I didn't review this issue earlier.)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2987>
_______________________________________
More information about the Python-bugs-list
mailing list