I have a stateful HTTP parser module that I've mentioned on the module-authors 
list and it was suggested that it be incorporated into LWP rather than 
directly added to CPAN.

I'm aware of a couple of HTTP request parsers (e.g. in 
POE::Component::Server::HTTP, HTTP::Daemon, and probably in SOAP::Lite too) 
but not a standalone one.

The module's add() method takes data and returns a 'hint' as to what it wants 
next (dies on error):
0 - done, call request() to get an HTTP::Request object
>0 - want this many bytes (e.g. Content-Length or chunked encoding)
-1 - need more data, not sure how much
-2 - need (at least) a full line of data

Of course, the hints can be completely ignored and data can just be passed in 
as received.

The module itself is viewable (temporarily) at 
http://davidrobins.net/code/misc/HTTP-Parser.pm.

I wrote it as part of an RVP (MS Instant Messenger) client, using the Event 
module for the event loop.

-- 
Dave
Isa. 40:31

Reply via email to