I should point out that Steve Dorner's example is illegal per the
multipart grammar in RFC 1341, it violates the "not occuring"
restrictions in the body-part nonterminal.
The multipart grammar in 1521 is just plain broken. The following
multipart is illegal in it, it violates the "not occuring"
restrictions on body-part:
Content-type: multipart/mixed; boundary="foo"
preamble
--foo
some text--foo
--foo--
As another example of brokenness, the multipart grammar in 1521 is
ambiguous. There are two legal parses of the following multipart:
Content-type: multipart/mixed; boundary="bar"
premable
--bar
text
--bar--
this can parse as an "epilogue" or as part of a "text/plain" inside
of the first "body-part".
other-line
--bar--
Now, if you change the above example such that the line "other-line"
is instead "--bar", then it has an unambiguous legal parse, where the
line starting "this" is inside the first of two body-parts. One has
to do an arbitrary amount of lookahead in order to determine the
corrct parse for the line starting "this".
Now, I think it's no big deal to expect composers to pick outer
boundary parameters to be long enough to not have
``CR LF "--" boundary'' be a substring in their enclosed body-parts.
No matter what we do, composers have to pick boundary parameters so
that some sequence is not a substring in their enclosed body-part.
Requiring parsers to look for something like
``CR LF "--" boundary 0*70(LWSP-char) CR LF''
or even worse ``CR LF "--" boundary 0*1000(LWSP-char) CR LF''
like Keith suggests is going to make life incredibly painful. I
seriously doubt many people would correctly implement such a parser.
--
_.John G. Myers Internet: jgm+(_at_)CMU(_dot_)EDU
LoseNet: ...!seismo!ihnp4!wiscvm.wisc.edu!give!up