lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Fri, Feb 25, 2011 at 6:41 PM, Miles Bader <> wrote:
> Sebastien Lai <> writes:
>> Currently, that seems like a fairly impossible target, considering that Perl
>> for example, makes heavy use of its regular expression engine to parse the
>> data properly.

Overkill. The spec uses a grammar, but it's written so that it doesn't
require a grammar to implement the parser. The string library is
perfectly adequate for the task. I've written MIME parsers using
regexps before. (I'm still using one.) It's like using a sledge hammer
to drive finish nails.

The client is supposed to supply a boundary string that does not occur
in the content, so if it happens that you find an instance of the
boundary string that leads to parsing errors then you treat the whole
message as invalid.

There's more to parsing multipart messages than just that boundaries,
but if I understand correctly that is the concern of the OP.

Yippee-ki-yay, coffee maker.