Subject: RFC2822 and Long Header lines

From: "Christopher T. Beers" <[email-masked]>
Date: Mon, 29 Mar 2004 20:11:23 -0500

For example, our listserv software from lsoft chooses to fold long list
subject lines like this

From: [email-masked]
Subject:      CAMPUS HOT NEWS: March 31: Award Ceremony Recognizes Geology
              Students
To: [email-masked]

When Mulberry (my mail client) sees this message it formats the subject
line in the header like this (notice the spaces/tabs between geology and
students).

Subject: CAMPUS HOT NEWS: March 31: Award Ceremony Recognizes Geology              Students

My interpretation of the rules is that all white space between CRLF and the
first character should should be replace with one space (if the mail client
wished to unfold the long header line) See 2.2.3.  LONG HEADER FIELDS in
RFC2822.

I contacted the Mulberry lists and Cyrus Daboo claims that the client
interprets what the IMAP server send it.  Below is a log of what Mulberry
received and you can see the unfolding in IMAP 2002e is not being handled
correctly.

I am attempting to attach the text log file since its formatted correctly.

-- 
Christopher T. Beers	
UNIX Systems Engineer - Syracuse University
250 Machinery Hall	Syracuse, NY 13244
(315) 443-4103 Office	(315) 443-1621 Fax

---

From: Mark Crispin <[email-masked]>
Date: Mon, 29 Mar 2004 17:42:19 -0800 (Pacific Standard Time)

Thank you for your report.

The email specifications have always danced around the issue of multiple 
WSP in continuation for an unstructured field body (such as Subject). 
RFC 2822 is no exception.

The exact text in RFC 2822 section 2.2.3 is:
    [...] Unfolding is accomplished by simply removing any CRLF
    that is immediately followed by WSP.

You interpret that statement to mean that unfolding is accomplished by 
substituting a single WSP for CRLF and one or more WSP.  c-client takes 
the more conservative interpretation of removing just the CRLF.

I believe that c-client's interpretation is closer to what RFC 2822 says. 
If your interpreted was intended, RFC 2822 would have said something like:
    [...] Unfolding is accomplished by removing any occurance
    of CRLF and following WSP.

Although I agree that in your specific example, the behavior you suggest 
is probably "better", that behavior is also destructive.  If, for whatever 
reason, that additional WSP is considered to be significant, your 
suggested because would cause damage to the string.  Furthermore, there is 
no reason to believe that one WSP is equivalent to multiple WSP in an 
unstructured field body.

Put another way, if c-client did as you suggested and it caused a problem, 
I would be hard-pressed to defend it given the text in RFC 2822.

Consequently, I believe that c-client is correct as-is and am not going to 
change this behavior.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.