[New-bugs-announce] [issue1698] urlparse and usernames containing @

Olivier Croquette report at bugs.python.org
Tue Dec 25 15:22:11 CET 2007

New submission from Olivier Croquette:

Some servers allow the @ character is usernames. It gives URLs like:

user at xyz could for example by an email address.

I am not sure if this is RFC compliant. What's sure is that is makes
trouble with urlparse: 

>>> from urlparse import urlparse
>>> p = urlparse("ftp://user@host1@host2/dir") 
>>> print p.username
>>> print p.hostname
host1 at host2

By using rsplit instead of split in lib/python2.5/urlparse.py, the
problem can be solved.

components: Library (Lib)
messages: 58990
nosy: ocroquette
severity: normal
status: open
title: urlparse and usernames containing @
type: behavior
versions: Python 2.5

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list