Support tail-glob in headers_remove. Bug 159
authorPeder Stray <peder.stray@gmail.com>
Mon, 3 Feb 2020 14:35:03 +0000 (14:35 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Mon, 3 Feb 2020 15:52:27 +0000 (15:52 +0000)
doc/doc-docbook/spec.xfpt
src/src/transport.c

index 410a166abef9847bc9af7b544ff417262f8534e5..aed97644c4f650342d39624e76608dc99f248174 100644 (file)
@@ -18654,8 +18654,10 @@ avoided. The &%repeat_use%& option of the &%redirect%& router may be of help.
 This option specifies a list of text headers,
 colon-separated (by default, changeable in the usual way &<<SECTlistsepchange>>&),
 that is associated with any addresses that are accepted by the router.
 This option specifies a list of text headers,
 colon-separated (by default, changeable in the usual way &<<SECTlistsepchange>>&),
 that is associated with any addresses that are accepted by the router.
-Each item is separately expanded, at routing time.  However, this
-option has no effect when an address is just being verified. The way in which
+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.
+The way in which
 the text is used to remove header lines at transport time is described in
 section &<<SECTheadersaddrem>>&. Header lines are not actually removed until
 the message is in the process of being transported. This means that references
 the text is used to remove header lines at transport time is described in
 section &<<SECTheadersaddrem>>&. Header lines are not actually removed until
 the message is in the process of being transported. This means that references
index ed3dcf0af7ccd622332fb1a0454ee5ee62e59e70..02994d2ca2981a20530068bf08f6a8bc766ea969 100644 (file)
@@ -738,10 +738,17 @@ for (header_line * h = header_list; h; h = h->next) if (h->type != htype_old)
            return FALSE;
            }
        len = s ? Ustrlen(s) : 0;
            return FALSE;
            }
        len = s ? Ustrlen(s) : 0;
-       if (strncmpic(h->text, s, len) != 0) continue;
-       ss = h->text + len;
-       while (*ss == ' ' || *ss == '\t') ss++;
-       if (*ss == ':') break;
+       if (len && s[len-1] == '*')     /* trailing glob */
+         {
+         if (strncmpic(h->text, s, len-1) == 0) break;
+         }
+       else
+         {
+         if (strncmpic(h->text, s, len) != 0) continue;
+         ss = h->text + len;
+         while (*ss == ' ' || *ss == '\t') ss++;
+         if (*ss == ':') break;
+         }
        }
       if (s) { include_header = FALSE; break; }
       }
        }
       if (s) { include_header = FALSE; break; }
       }