[Top] [All Lists]

Re: Comments on draft-daboo-sieve-mime-00.txt

2004-03-17 12:48:43

On Tue, Mar 16, 2004 at 12:10:30AM -0000, Nigel Swinson wrote:

   [ alternative mime tests description ]

This all mostly sounds very good.  Some random reflections:

If we think :value is too confusing for the "header value when with
parameters" compared to the "whole header value", then perhaps we
could use :valueonly, :noparameters or :mimevalue or something else?
Maybe the prefix could be like a "namespace" defining the header
parsing algorithm to use, and if we have other headers that have a
common structure, we could define other namespaces that detail the
header parsing method to use.

I too think that ":value" is not the best choice, for various reasons,
some of which have been already stated.  ":type" probably works for
the mime headers but might not be as meaningful if this is later used
to apply to other headers of similar form.  What there really are are
fixed parts and variable keyword=value parts.  This doesn't really
inspire any other good names, though.

The above would test only in the "active body part" which is the top
level body part, which is the email headers, which is what we've all
been dealing with already.  It would NOT recursively look for headers
in all child body parts.
The second significant half of MIME permits us to recursively define
body parts, which each have a set of headers, and content.  So any
solution that we have needs to cope with the potential recursive
nature of the MIME structure.  So what if we define a new tagged
argument for use with all of our existing tests that specifies that we
should recursively look in the body parts too?  Call it :bodyparts.
So this means that if I write a test that says:

    if header :contains "Content-Type" "text/html"

Then this would only match if the message contains a single body part
that is text/html.  However if I write the following, then this would
match if there is ANY text/html body part anywhere in the legal MIME
structure of the message:

    if header :bodyparts :contains "Content-Type" "text/html"

Do you intend :bodyparts to select the mime parts in the message body,
or in the entire message (i.e., does it include or exclude the message
header?)  My preference would be the body only, so that one can have
the most flexibility.

Then if we combine this with allof(), we could further define that
multiple tests within an allof() must apply to the same body part.  So
if we say:

    if allof :bodyparts (header :value :contains "Content-Type" "image/jpeg",
                                  size :over 100K)

Syntactically this is interesting, although as I've said before I think
a full-fledged notion of "views" would be more so (but obviously that's a
whole nother track).  I wonder how various implementors feel about
connecting "allof" with its contained tests in this way -- especially
if they are allowed to nest.

6) Test for text in any parameter values only in a specific MIME header

    if (mimeheader :name "Content-Disposition" :parameter-value :contains 

if header :bodyparts :anyparameter :contains "Content-Disposition" ".exe"

Rather than introduce another keyword, I'd suggest using a special
parameter value string to match any actual parameter.  e.g.:

    if header :bodyparts :parameter "" :contains "Content-Disposition" ".exe"
    if header :bodyparts :parameter "*" :contains "Content-Disposition" ".exe"

Perhaps even say that the ":parameter" value is tested using a wildcard
match (a la :matches).

What do you think?

Very nice..