[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- 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 <miles@gnu.org> wrote:
> Sebastien Lai <237482@googlemail.com> 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.
>
> LPEG?
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.
Chris
--
Yippee-ki-yay, coffee maker.