Re: [exim] header folding

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Ross Boylan
CC: Exim-users
Subject: Re: [exim] header folding
On Fri, 23 Jun 2006, Ross Boylan wrote:

> Inspired by $spam_report, I'm looking for some details about how exim
> handles header folding, including folding from string expansions.


It doesn't.

> First, does exim ever add header folding on its own, e.g., if the lines
> would be long?


No.

> Second, I gather the standard way to do multiple lines is, for an ACL,
>   add_header = X-Foo: some text\n\
>     line 2, with at least one space at the start


Not quite, because Exim ignores white space at the start of continuation
lines in its config. You need

   add_header = X-Foo: some text\n \
     line 2


Note the space after the \n. You can also use this technique for adding
more than one header, or you can use:

    add_header = X-Foo: xxx
    add_header = X-Bar: xxx 


for the latter.

> What if you have
> add_header = X-Bar: $var
> ?
> Should $var expand to the literal text that includes \n\ (where those
> are literal slashes, not escape characters), or can it have the
> characters directly?


If $var contains literal slashes, they will be inserted as literal
slashes unless you write ${expand:$var}. If you do that, or if $var
contains actual newlines, they will act as newlines.

> I assume that the separator should be \n (the escape character), not a
> CRLF, since exim operates using the former according to section 43.2
> "Line Endings". Right?


Correct.

> I've been concerned about the operation in an acl, as described in 39.19
> "Adding header lines in ACLs", but that indicates that adding headers
> works a bit differently in other parts of exim. If there are any
> differences in this area, I'd like to know.


The main difference is that you can have more than one add_header
modifier in an ACL, but only one add_header option for a router or
transport.

-- 
Philip Hazel            University of Cambridge Computing Service
Get the Exim 4 book:    http://www.uit.co.uk/exim-book