[issue1698] urlparse and usernames containing @

Olivier Croquette report at bugs.python.org
Wed Dec 26 17:38:24 CET 2007


Olivier Croquette added the comment:

Hi!

Thanks for the reply!

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.

PS: will urlparse transform an encoded "@" in the username when
.username is called, or does the application have to decode explicitely?

Olivier

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1698>
__________________________________


More information about the Python-bugs-list mailing list