[cvs] mime attachments [was: keep size down]

Gyepi SAM gyepi at praxis-sw.com
Mon Dec 30 06:30:05 CET 2002


On Sun, Dec 29, 2002 at 10:50:43PM -0500, David Relson wrote:

> As you've noticed the current mime implementation doesn't do 
> nesting.  Rather it uses msg_stack to keep track of the multiple parts of a 
> multipart message.  I'm thinking a better approach to handling multiple 
> parts would be to have a linked list of parts for each level of mime 
> nesting.

I think a stack is the right approach here. Granted, one could implement
a stack with a linked list. (In fact, I just did such a thing a couple of days
ago). One nice benefit is that we don't have to set an arbitrary depth limit
for the stack.
 
> However, as I wrote the above, I wonder if we really need to keep track of 
> multiple parts for a given level.  Each time bogofilter gets to a boundary, 
> it has completed one part and is starting a new part.  So, at any given 
> level, there is only one part actually being processed.  There is no need 
> to remember anything about the previous part.  All that matters is the 
> boundary (one per mime level) and the info on the current part.

For most  mime messages, what you describe will work.
Keep in mind, however, that that nested multipart messages are legal
(obviously with different delimiters)
and multipart/digest messages change delimiters within the mime part and that
a higher level boundary can close a nested section. All this means that when
a message is nested, we need to keep the higher level message on stack until we have unrolled all the nested parts. But we should pop the stack when we're
finished with a message.

I have got a bunch of code brewing that might help with this.

-Gyepi





More information about the bogofilter-dev mailing list