[Python-bugs-list] [ python-Bugs-437395 ] RFC 2822 conformance

noreply@sourceforge.net noreply@sourceforge.net
Mon, 16 Jul 2001 13:41:54 -0700


Bugs item #437395, was opened at 2001-06-29 09:10
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=437395&group_id=5470

Category: Python Library
Group: Feature Request
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Fred L. Drake, Jr. (fdrake)
Assigned to: Barry Warsaw (bwarsaw)
Summary: RFC 2822 conformance

Initial Comment:
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.)

----------------------------------------------------------------------

>Comment By: Barry Warsaw (bwarsaw)
Date: 2001-07-16 13:41

Message:
Logged In: YES 
user_id=12800

Patch applied to rfc822.py 1.58

----------------------------------------------------------------------

Comment By: Barry Warsaw (bwarsaw)
Date: 2001-07-16 13:00

Message:
Logged In: YES 
user_id=12800

philhunt is correct in this case.  The relevant section of
RFC 2822 is $4.1 Miscellaneous obsolete tokens.  "Period"
(aka "full stop" or ".") is defined as obsolete syntax,
specifically in the obs-phrase production.  We MUST accept this.

Attached is the meat of the patch for rfc822.py to fix this
(there will be some other changes included in what I check
in though -- mostly updates to docstrings and such).

----------------------------------------------------------------------

Comment By: Philip Hunt (philhunt)
Date: 2001-07-08 12:05

Message:
Logged In: YES 
user_id=236441

rfc822 *doesn't* conform to RFC2822. As an example,
when we have a field

From: From: A. N. Other <another@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@nowhere.org.ca>

then getaddr("From") correctly returns 
('A N Other', 'another@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.
   

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=437395&group_id=5470