Re: [exim] how exim parses multiple headers into variables

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Marc Haber
Date:  
À: exim-users
Sujet: Re: [exim] how exim parses multiple headers into variables
On Mon, 27 Apr 2015 21:57:28 +0200, Heiko Schlichting
<exim-users@???> wrote:
>Marc Haber wrote:
>> I have an interesting behavior of exim on Debian regarding multiply
>> existing headers - but it also may be something really stupid.
>>
>> [...]
>> |X-Spam-Score: -4.2
>> |X-Spam-Score: -4.4
>> [...]
>> |headers add "${if !eq {$h_x-malware-found:}{}\
>> |              {X-torres-Malware-Found: $h_x-malware-found:\n}{}}\
>> |             ${if !eq {$h_x-spam-score:}{}\
>> |              {X-torres-Spam-Score: $h_x-spam-score:\n}{}}\
>> [...]
>> Please notice that the contents of the two X-Spam-Score headers get
>> folded into a single one, with an empty line between the two
>> instances, and the second content without a leading space.

>
>This is not a bug. $h_x-spam-score: has a value of "-4.2\n-4.4" within your
>filter as documented:
>
>| If there is more than one header with the same name, they are all
>| concatenated to form the substitution string, up to a maximum length of
>| 64K. Unless rheader is being used, leading and trailing white space is
>| removed from each header before concatenation, and a completely empty
>| header is ignored. A newline character is then inserted between non-empty
>| headers, but there is no newline at the very end.


Well, that sucks.

>For insertion with correct folding you can try experimenting with $rh_...


That didn't work. Replacing \n with \n<space> did:
|             ${if !eq {$h_x-spam-score:}{}\
|              {X-Old-Spam-Score: ${sg{$h_x-spam-score:}{[\n\r]}{\n }}\n}{}}\


Mucho ugly. I'd rather have a cleaner solution.

Greetings
Marc
-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber         |   " Questions are the         | Mailadresse im Header
Mannheim, Germany  |     Beginning of Wisdom "     | http://www.zugschlus.de/
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834