Subject: [Extra] Sieve addheader

From: Ken Murchison <[email-masked]>
Date: Wed, 8 Apr 2020 15:21:27 -0400

All,

Had an interesting Sieve failure recently.  A user had an addheader 
action similar to this:

addheader "X-Foo" text:
bar
.
;

My implementation simply (mistakenly?) took the value string as-is and 
appended CRLF when inserting it into the message.  This obviously breaks 
the message because

"The CRLF before the final period is considered part of the value."

per Section 2.4.2 of RFC 5228, which when followed by the CRLF that I 
add results in a blank line between the X-Foo header and any subsequent 
header.

My question is, should implementations strip any trailing CRLF from the 
header value, or reject the script as invalid because the header value 
(with the trailing CRLF) isn't a valid "unstructured" element per 
Section 4 of RFC 5293?

-- 
Ken Murchison
Cyrus Development Team
Fastmail US LLC

---

From: Ned Freed <[email-masked]>
Date: Wed, 08 Apr 2020 13:38:10 -0700 (PDT)

> ..

> (with the trailing CRLF) isn't a valid "unstructured" element per

I think either behavior can be justified given what the RFC says, but FWIW we
replace CRLFs with spacess. (We originally just removed them, but found the
result to be suboptimal with some scripts.) There's also the question of UTF-8
-> encoded words, which is tricky because you have to know the syntax to do it
correctly for structured fields.

				Ned