HTTP Parser

acme on 2008-01-05T18:45:44

Dear Lazyweb, please write a XS module which interfaces to Mongrel's HTTP Parser (also seen in Thin). I'll buy you dimsum!


Sure, why not

Andy Grundman on 2008-01-05T21:38:39

Hmm, I might take a crack at it.

That state language compiler sure generates some nasty C code though!

PerlBal

Matts on 2008-01-06T00:06:22

Has an XS HTTP Header parser on CPAN.

Re:PerlBal

Andy Grundman on 2008-01-06T00:57:03

Yeah I looked at that once, but it doesn't give you an HTTP::Request object or anything nice like that.

What we also need is a fast HTTP body parser in C, our HTTP::Body module in Catalyst is really slow for doing things like multipart body parsing. Haven't looked at Mongrel enough yet to know if it does body parsing or just headers.

May not be as fast...

Andy Grundman on 2008-01-06T21:33:46

I wrote a quick XS wrapper for benchmark purposes and for parsing a real-world header, here are the results.

                  Rate http-parser-xs        perlbal
http-parser-xs 55582/s             --           -12%
perlbal        63509/s            14%             --

This is just raw parsing speed, not creation of a useful HTTP::Request object.