[Email-SIG] Interesting requirement of RFC 2046

Barry Warsaw barry at python.org
Tue May 11 17:06:54 EDT 2004


Here's the quote:

5.1.2.  Handling Nested Messages and Multiparts

   The "message/rfc822" subtype defined in a subsequent section of this
   document has no terminating condition other than running out of data.
   Similarly, an improperly truncated "multipart" entity may not have
   any terminating boundary marker, and can turn up operationally due to
   mail system malfunctions.

   It is essential that such entities be handled correctly when they are
   themselves imbedded inside of another "multipart" structure.  MIME
   implementations are therefore required to recognize outer level
   boundary markers at ANY level of inner nesting.  It is not sufficient
   to only check for the next expected marker or other terminating
   condition.

Which tells me that BufferedSubFile's implementation isn't quite right,
since it only matches the next line against the top of the EOF stack. 
It should probably check against /every/ predicate on that stack,
returning EOF if any of them match.

I think it should also keep the current line in the buffer so that for
nested parts, it'll return from the recursion and possibly immediately
get another EOF.

I'll have to work out a test case for that, after I get closer on the
torture tests.

-Barry





More information about the Email-SIG mailing list