[Top] [All Lists]

Re: Non destructive folding/unfolding (ie, no insertion ofwhitespace in unfolding)

2007-11-01 04:18:06

At 01:35 01/11/2007, Mikel Lindsaar wrote:

Hello list,

This is my first post, so I apologise if this has already been
covered.  I searched through the full text archive file of ietf-822
(after going through the full itef-smtp archive file) and could not
find a concrete answer to my question.

I am improving/fixing bugs in a Email library for Ruby - I didn't
originally write the library, so I am being very careful in any
changes I make.

One situation I have is where a X-header field and Reply-To field has
a single piece of text that is longer than the 78 octet limit, but has
no white space break.

For example:

Reply-To: <1234-1234-1234-1234-1234-1234-1234-1234-1234(_at_)me-some-host-over-here(_dot_)org>

The library currently folds this line as:


Now, I have two questions.

1) I believe that putting the CRLF immediately after the : in the
header field name is in violation of 2822 specifically that the header
line should contain the name, a colon, the field and terminated by a
CRLF.  Would this be a correct interpretation?

As I understood it this was OK. For a general unstructured header field, it begins with optional FWS, so can be folded there. The 'Reply-To' is a bit different because it's structured, but I thought that FWS could be added at will around the address fields in a reply-to field. (I can't find the description of this at the moment in RFC 2822, but I'm pretty sure it's OK as that's what section 2.2.2 seems to say

2) Irregardless of (1), what is the correct handling of a piece of
text in the field that is longer than 78 characters, but contains no
whitespace to fold?  ie, in unfolding, no whitespace can be inserted
back into the original text which would be destructive to the original

Just leave it longer than 78

78 is a 'soft' limit, 998 is the hard limit.

Section 2.1.1 -
Each line of characters MUST be no more than
   998 characters, and SHOULD be no more than 78 characters, excluding
   the CRLF

I saw one mention of doing this:

Reply-To: <1234-1234-1234-1234-1234-12\CRLF

NO - this will break things. You can only fold at FWS, you can't randomly insert FWS into a structured header field...

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Non destructive folding/unfolding (ie, no insertion ofwhitespace in unfolding), Paul Smith <=