From 6656a75a7b16170afdbbf4ac558f56f4e0ef75ac Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 3 Feb 2020 15:30:43 +0000 Subject: [PATCH] Testsuite: headers_remove globbing. Bug 159 --- doc/doc-docbook/spec.xfpt | 24 ++++++++++++++++-------- doc/doc-txt/NewStuff | 4 ++++ test/confs/0481 | 2 +- test/mail/0481.userx | 1 + test/scripts/0000-Basic/0481 | 5 +++++ 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index aed97644c..43199cf7c 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -18655,8 +18655,10 @@ This option specifies a list of text headers, colon-separated (by default, changeable in the usual way &<>&), that is associated with any addresses that are accepted by the router. However, the option has no effect when an address is just being verified. -Each list item is separately expanded, at routing time. -If an item ends in *, it will match any header with the same prefix. +Each list item is separately expanded, at transport time. +.new +If an item ends in *, it will match any header with the given prefix. +.wen The way in which the text is used to remove header lines at transport time is described in section &<>&. Header lines are not actually removed until @@ -18664,7 +18666,7 @@ the message is in the process of being transported. This means that references to header lines in string expansions in the transport's configuration still &"see"& the original header lines. -The &%headers_remove%& option is expanded after &%errors_to%& and +The &%headers_remove%& option is handled after &%errors_to%& and &%headers_add%&, but before &%transport%&. If an item expansion is forced to fail, the item has no effect. Other expansion failures are treated as configuration errors. @@ -21843,15 +21845,21 @@ checked, since this option does not automatically suppress them. .option headers_remove transports list&!! unset .cindex "header lines" "removing" .cindex "transport" "header lines; removing" -This option specifies a list of header names, -colon-separated (by default, changeable in the usual way &<>&); -these headers are omitted from the message as it is transported, as described -in section &<>&. Header removal can also be specified by -routers. +This option specifies a list of text headers, +colon-separated (by default, changeable in the usual way &<>&), +to be removed from the message. +However, the option has no effect when an address is just being verified. Each list item is separately expanded. If the result of the expansion is an empty string, or if the expansion is forced to fail, no action is taken. Other expansion failures are treated as errors and cause the delivery to be deferred. +.new +If an item ends in *, it will match any header with the given prefix. +.wen + +Matching headers are omitted from the message as it is transported, as described +in section &<>&. Header removal can also be specified by +routers. Unlike most options, &%headers_remove%& can be specified multiple times for a transport; all listed headers are removed. diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 3542c82cb..919a56ea5 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -35,6 +35,10 @@ Version 4.94 9. The ACL control "queue_only" can also be spelled "queue", and now takes an option "first_pass_route" to do the same as a "-odqs" on the command line. + 9. Items specified for the router and transport headers_remove option can use + a trailing asterisk to specify globbing. + + Version 4.93 diff --git a/test/confs/0481 b/test/confs/0481 index 09e3ed89e..cdd6453dc 100644 --- a/test/confs/0481 +++ b/test/confs/0481 @@ -25,7 +25,7 @@ r2: r3: driver = accept - headers_remove = Remove-Me: + headers_remove = Remove-Me:X-Rem* headers_add = X-Was-Remove-Me: >$h_remove-me:< headers_add = ${if def:h_remove-me-also {X-Was-Remove-Me-Also: >$h_remove-me-also:<}} transport = t1 diff --git a/test/mail/0481.userx b/test/mail/0481.userx index 07700dd92..4af9fec86 100644 --- a/test/mail/0481.userx +++ b/test/mail/0481.userx @@ -16,6 +16,7 @@ Received: from CALLER by myhost.test.ex with local (Exim x.yz) id 10HmaY-0005vi-00 for userx@myhost.test.ex; Tue, 2 Mar 1999 09:44:33 +0000 Another: This is another header +X-Ren-dont: test globbing Message-Id: From: CALLER_NAME Date: Tue, 2 Mar 1999 09:44:33 +0000 diff --git a/test/scripts/0000-Basic/0481 b/test/scripts/0000-Basic/0481 index be89249f3..08a5181a2 100644 --- a/test/scripts/0000-Basic/0481 +++ b/test/scripts/0000-Basic/0481 @@ -9,4 +9,9 @@ Another: This is another header Remove-Me-Also: me too! Remove-Me-Too: me too! Remove-Me-Too2: me too! +X-Rem-1: test globbing +X-Rem-2: test globbing +X-Rem-foobar: test globbing +X-Rem: test globbing +X-Ren-dont: test globbing **** -- 2.30.2