mirror of mongrel-development@rubyforge.org (inactive)
 help / color / mirror / Atom feed
From: "Zed A. Shaw" <zedshaw-dd7LMGGEL7NBDgjK7y7TUQ@public.gmane.org>
To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Subject: Re: Pure Ruby HTTP parser
Date: Tue, 6 May 2008 02:27:29 -0400	[thread overview]
Message-ID: <20080506022729.f0db321e.zedshaw@zedshaw.com> (raw)
In-Reply-To: <3ae7f4480804240438g62ed7190if2a84ff08dd2fe34-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu, 24 Apr 2008 13:38:03 +0200
"ry dahl" <ry-Xek56AhD01PHviPkdFu9cA@public.gmane.org> wrote:

> One could replace http11's parser with some regular expressions and
> out-of-bounds checking rather easily. I think Kirk Haines did this (?)
> and said it was rather comparable in speed to the C/Ragel state
> machine. I guess that wasn't really the point of your exercise, but
> it's worth noting, if anyone actually wants a pure ruby http parser.

Yes, fast, but not correct.  The main difference between a generated
parser based on algorithms and hand crafted regex is when the parser
blows up it says:

"Syntax error at character #34 expecting BLAH, FOO, and BAR symbols."

Regexen do this:

"Hi, oh thanks, I *love* hacks like this.  You crafted this shellcode
really well so that it looks mildly like a payload.  Super awesome I'll
just pass this vaguely HTTP string right on to our app."

:-)

-- 
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/

      parent reply	other threads:[~2008-05-06  6:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24  0:50 Pure Ruby HTTP parser Tony
     [not found] ` <c7e6b2b00804231750o1c86d377i25c83d5e99f41dd1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-04-24 11:38   ` ry dahl
     [not found]     ` <3ae7f4480804240438g62ed7190if2a84ff08dd2fe34-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-04-26 23:33       ` Tony
     [not found]         ` <c7e6b2b00804261633y2835329eqaa1b0190e19f59ac-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-04-26 23:57           ` Luis Lavena
2008-05-06  6:27       ` Zed A. Shaw [this message]
replies disabled, historical list

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).