Senthil added the comment:

Hi ocroquette,

Even though I have seen ftp sites requesting email addresses as user
names, I would rather put this issue for discussion as this not per any RFC.

urlparse is based upon RFC1808 and it points to RFC1738 for the URL
Syntax. RFC1738 specifically says (line 225) that:

The user name (and password), if present, are followed by a commercial
at-sign "@". Within the user and password field, any ":", "@" or "/"
must be encoded.



>>> url = "ftp://[EMAIL PROTECTED]@host/dir"
>>> from urlparse import urlparse
>>> p = urlparse(url)
>>> print p.username
user
>>> print p.hostname
[EMAIL PROTECTED]
>>> corr_url = "ftp://[EMAIL PROTECTED]/dir"
>>> q = urlparse(corr_url)
>>> print q.username
user%40xyz
>>> print q.hostname
host
>>>

So, it is upon the user/client to encode the @sign in the user name, if
he has to be compliant with RFC. 
urlparse is not at fault here.
What shall we do with this issue?

----------
nosy: +orsenthil

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1698>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to