[Mongrel] http helpers c extension

Zed A. Shaw zedshaw at zedshaw.com
Sat Sep 22 14:57:43 EDT 2007


On Sat, 22 Sep 2007 19:59:57 +0200
"ry dahl" <ry at tinyclouds.org> wrote:

> hi,
> 
> I rewrote escape, unescape, and query_parse in a C extension.
> http://s3.amazonaws.com/four.livejournal/20070922/http_helpers.tar.bz2

I'll take a look at this during the weekend and check the code.  So far the benchmarks are good so I'll talk with the mongrel team and see what they think.  Are you actively using this?
 
> 
> My query_parse implements a different behavior than Mongrel has.
> Mongrel interprets "q[a]=b" to be { 'q[a]' => 'b' }. Instead the C
> extension mimic's Merb's behavior, creating nested hashes.

I think that works for Merb and your stuff, but Rails expects the cgi.rb flavor (which isn't correct, your's is).  Have you tried it with rails yet?

> I think mongrel should change the behavior of it's query_parse
> function and use a C implementation. HttpHelpers.query_parse also uses
> a ragel state machine, so it shouldn't be increadably hard to put this
> query_parse directly into http11.

That's entirely true, but let me double check your C.  If I find a buffer overflow you owe me a pizza. :-)

> 
> Is there a development branch of mongrel? What should I patch against?

Go join the development list.  I'm starting to slowly come out of hiding and will be working to direct the mongrel team volunteers as they try to push out 1.0.2.  There's no development branch, but we could try to work this in.

http://rubyforge.org/mailman/listinfo/mongrel-development

> What do people feel about how query_parse should behave? Should it
> happen automatically as Mongrel parses the rest of the query? Should
> it by default use the Merb hash syntax?

Now, you did this with Ragel, what about merging the parsing into the existing http11 parser to do this all inline and on the fly?  That way, when it comes out it's C coma it's got a fully cooked response.

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


More information about the Mongrel-users mailing list