MBOX-Line: From bill.shannon at ymail.com  Mon Oct 29 15:21:47 2012
To: imap-protocol@u.washington.edu
From: Bill Shannon <bill.shannon@ymail.com>
Date: Fri Jun  8 12:34:49 2018
Subject: [Imap-protocol] significance of leading whitespace in RFC 2822
	unstructured headers
Message-ID: <508F017B.4000606@ymail.com>

(Maybe there's an RFC 2822 experts list that would be more appropriate
for this question?  If so, please point me in the right direction.)

According to the RFC 2822 syntax, any whitespace after the colon in
an unstructured header is part of the value of that header.
This means that in the header

Subject: test

The value of the subject header is " test" with a leading space.

I suspect the UW IMAP server is not alone in returning "test" as the
subject for such a message.

Similarly for the Content-Description header.

(A quick test shows that the UW IMAP server preserves trailing whitespace
but not leading whitespace in Subject and Content-Description headers.)

Am I misinterpreting the RFC 2822 spec?  I'd really like that leading whitespace
to be insignificant, and I suspect that's the way most people and software
treat it, but I can't see where the spec says that.

This is an issue because an OASIS security spec says that all whitespace
in unstructured headers must be preserved, and factors into the digital
signature of the message.

Thanks.

