POE::Filter::HTTP::Parser - A HTTP POE filter for HTTP clients or servers
use POE::Filter::HTTP::Parser; # For HTTP Servers my $request_filter = POE::Filter::HTTP::Parser->new( type => 'server' ); my $arrayref_of_request_objects = $filter->get( [ $stream ] ); my $arrayref_of_HTTP_stream = $filter->put( $arrayref_of_response_objects ); # For HTTP clients my $response_filter = POE::Filter::HTTP::Parser->new( type => 'client' ); my $arrayref_of_HTTP_stream = $filter->put( $arrayref_of_request_objects ); my $arrayref_of_response_objects = $filter->get( [ $stream ] );
It can be used to easily create POE based HTTP servers or clients.
type set to
server, the reverse will happen.
get will parse HTTP::Request objects from HTTP streams and
put will accept HTTP::Response objects and convert them to HTTP streams. Like POE::Filter::HTTPD if there is an error parsing the HTTP request, this filter will generate a HTTP::Response object instead, to encapsulate the error message, suitable for simply sending back to the requesting client.
Creates a new POE::Filter::HTTP::Parser object. Takes one optional argument,
typewhich determines whether the filter will act in
clientis the default if
typeis not specified.
'type', set to either 'client' or 'server', default is 'client';
Returns any data remaining in a filter's input buffer. The filter's input buffer is not cleared, however. Returns an array reference if there's any data, or undef if the filter was empty.
This does make sense if you think about it.
The given objects are returned to their stream form.
Makes a copy of the filter, and clears the copy's buffer.
Chris Williams <email@example.com>
This software is copyright (c) 2016 by Chris Williams, Artur Bergman and Rocco Caputo.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.