Author ggenellina
Date 2007-06-09.05:19:09
SpamBayes Score
Marked as misclassified
Quoting RFC2822 section 2.2.3 <>: 

"""The general rule is that wherever this standard allows for folding white space (not simply WSP characters), a CRLF may be inserted before any WSP. For example, the header field:

           Subject: This is a test

can be represented as:

           Subject: This
            is a test

[...]Unfolding is accomplished by simply removing any CRLF that is immediately followed by WSP."""

That is, folding is done by inserting ONLY the sequence CRLF before any folding whitespace. When the header is interpreted, the whitespace is NOT removed, only the CRLF. The posted Subject header should become "Subject: 1 2 3...7 8\n\r 9 1 2...'

I think this is a bug in the email.header.Header class; its __init__ says, about the continuation_ws argument: "[it] must be RFC 2822 compliant folding whitespace (usually either a space or a hard tab) which will be prepended to continuation lines.". Folding does not involve *prepending* any whitespace, just inserting CRLF right before *existing* whitespace.

Note that this is wrong even for the old RFC 822 (with slightly different rules for line folding.)
Date User Action Args
2007-08-23 14:51:33adminlinkissue1645148 messages
2007-08-23 14:51:33admincreate