[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LunarCGI (was Re: CGI.lua - A native CGI Interface)
- From: Chris Babcock <cbabcock@...>
- Date: Fri, 25 Feb 2011 22:15:04 -0700
On Fri, Feb 25, 2011 at 6:41 PM, Miles Bader <email@example.com> wrote:
> Sebastien Lai <firstname.lastname@example.org> 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.