[issue1698] urlparse and usernames containing @
report at bugs.python.org
Wed Dec 26 18:24:55 CET 2007
Senthil added the comment:
> Olivier Croquette added the comment:
> The problem right now is that urlparse parses silently an URL which is
> not compliant, but does the wrong thing with it (since usernames can
> contain @, and hostname can not, it's a more logical thing to parse from
> the right using rsplit instead of split).
> I see two possibilities to address that:
> 1. return a parse error if the URL contains two raw @
> This way users and app developers will notice the problem rapidly
> 2. still accept this malformed URLs, but do what the user expects
> Both solutions seem to me better than the current behaviour, so I would
> say a change is necessary anyways.
I am inclined towards the option 2, wherein even if the non-conformant URL is
given, which has "@" in the user name, the urlparse should be able atleast
recognize the hostname correctly. In this case, using rsplit instead of split
does the trick.
Attached is the patch against the trunk, which adds this. I notice duplicity
project also retorting to the same.
Unless anyone has an objection, we should commit this change.
Added file: http://bugs.python.org/file9030/urlparse_issue1698.patch
Tracker <report at bugs.python.org>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Python-bugs-list