develooper Front page | perl.libwww | Postings from December 2003

Adding HTTP::Parser module to LWP

David Robins
December 14, 2003 12:05
Adding HTTP::Parser module to LWP
Message ID:
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

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

Isa. 40:31 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About