ietf-mta-filters
[Top] [All Lists]

Re: Stripping leading/trailing spaces in relational draft

2005-10-12 18:43:32

On Wed, 2005-10-12 at 18:28 -0400, Mark E. Mallett wrote:
If white space
is stripped on the left side (message value), it should be stripped on the
right side (literal) the same way, but that is an independent issue.

I agree with the last part, but not the first :-)  I think that the
space-stripping conversation should be focused on the test inputs that
the script writer doesn't explicitly control, i.e. to the inputs that
are supplied by the implementation "from the message."  If the script writer
supplies a literal with spaces in it, and it doesn't make sense, well
that's a script bug.  The script writer has the ability to repair that
mistake.

I think this makes sense.  consider this example:

        require "variables";
        if header :matches "Subject" "*" {
                set "subject" "${1}";
        }
        if string :is "${subject}" "devious" ...

if the message contains "Subject: devious ", the "string" test should
IMO succeed, *but* the stripping didn't happen there -- it should be
done by the "header" test.  in other words, ${1} contained "devious"
without the trailing space since the "Subject" value was stripped.

I want to revert the suggested text and example in "variables" about the
interaction with "relational", and the new suggested change relative to
the currently published -06 draft is as follows:


 5.  Test string
 
    Usage:    string [MATCH-TYPE] [COMPARATOR]
              <source: string-list> <key-list: string-list>
 
    The "string" test evaluates to true if any of the source strings
    matches any key.  The type of match defaults to ":is".
 
+   Some match types mandate stripping of leading and/or trailing
+   whitespace from the inputs prior to comparison whenever the string
+   value is taken from the message.  In the "string" test, both
+   source and key-list are taken from the script, not the message,
+   and whitespace stripping MUST NOT be done unless the script
+   explicitly requests this through some future mechanism.
+
    Example:
       set "state" "${state} pending";
       if string :matches " ${state} " "* pending *" {
           # the above test always succeeds
       }
 
    The "relational" extension [RELATIONAL] adds a match type called
    ":count".  The count of a single string is 0 if it is the empty
    string, or 1 otherwise.  The count of a string list is the sum of the
    counts of the member strings.


forgive my narrow focus on "variables" just now, but I really want to
get the document done.

And I would love to keep this out of the relational extension, if I had
a choice.

Agreed.

yes, the behaviour really needs to get into the base spec.
-- 
Kjetil T.