Bug in rfc822
phil hunt
philh at comuno.freeserve.co.uk
Sun Jul 8 15:20:31 EDT 2001
Python Bug Report #437395 states:
The rfc822 and smtplib modules need to be checked for
conformance with RFC 2822, which obsoletes RFC 822.
(Added this to the tracker so we don't lose track of this.)
I have just found out that rfc822.py doesn't conform to
RFC2822. As an example, when we have a field:
From: From: A. N. Other <another at nowhere.org.ca>
then getaddr("From") returns ('', 'A.N.Other')
which is incorrect.
When the from line is changed to:
From: From: A N Other <another at nowhere.org.ca>
then getaddr("From") correctly returns
('A N Other', 'another at nowhere.org.ca')
The relevant parts of the syntax specified in rfc2822
are:
from = "From:" mailbox-list CRLF
mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list
mailbox = name-addr / addr-spec
name-addr = [display-name] angle-addr
display-name = phrase
phrase = 1*word / obs-phrase
obs-phrase = word *(word / "." / CFWS)
>From rfc2822, section 4.1:
Note: The "period" (or "full stop") character (".") in obs-phrase is
not a form that was allowed in earlier versions of this or any other
standard. Period (nor any other character from specials) was not
allowed in phrase because it introduced a parsing difficulty
distinguishing between phrases and portions of an addr-spec (see
section 4.4). It appears here because the period character is
currently used in many messages in the display-name portion of
addresses, especially for initials in names, and therefore must be
interpreted properly. In the future, period may appear in the
regular syntax of phrase.
I have added a comment to bug #437395, to this effect. Do
I need to notify anyone else? The Bug Report says it was submitted
by Fred Drake, and assigned to Barry Warsaw.
--
## Philip Hunt ## philh at comuno.freeserve.co.uk ##
More information about the Python-list
mailing list