Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

http::proxy::engine(3pm) [debian man page]

HTTP::Proxy::Engine(3pm)				User Contributed Perl Documentation				  HTTP::Proxy::Engine(3pm)

NAME
HTTP::Proxy::Engine - Generic child process manager engine for HTTP::Proxy SYNOPSIS
use HTTP::Proxy; # use the default engine for your system my $proxy = HTTP::Proxy->new(); # choose one my $proxy = HTTP::Proxy->new( engine => 'Old' ); DESCRIPTION
The HTTP::Proxy::Engine class is a front-end to actual proxy engine classes. The role of an engine is to implement the main fork+serve loop with all the required bookkeeping. This is also a good way to test various implementation and/or try out new algorithms without too much difficulties. METHODS
new() Create a new engine. The parameter "engine" is used to decide which kind of engine will be created. Other parameters are passed to the underlying engine. This method also implement the subclasses constructor (they obviously do not need the "engine" parameter). CREATING YOUR OWN ENGINE
It is possible to create one's own engine, by creating a simple subclass of HTTP::Proxy::Engine with the following methods: start() This method should handle any initialisation required when the engine starts. run() This method is the main loop of the master process. It defines how child processes are forked, checked and killed. The engine MUST have a run() method, and it will be called again and again until the proxy exits. $self->proxy->daemon returns the listening socket that can accept() connections. The child must call $self->proxy->serve_connections() on the returned socket to handle actual TCP connections. stop() This optional method should handle any cleanup procedures when the engine stops (typically when the main proxy process is killed). A subclass may also define a %defaults hash (with "our") that contains the default values for the fields used internaly. METHODS PROVIDED TO SUBCLASSES
HTTP::Proxy::Engine provides the following methods to its subclasses: proxy() Return the HTTP::Proxy object that runs the engine. max_clients() Get or set the maximum number of TCP clients, that is to say the maximum number of forked child process. Some engines may understand a value of 0 as do not fork at all. This is what HTTP::Proxy::Engine::Legacy does. make_accessors( @names ) Create accessors named after @names in the subclass package. All accessors are read/write. This is a utility method. This is a class method. AUTHOR
Philippe "BooK" Bruhat, "<book@cpan.org>". COPYRIGHT
Copyright 2005, Philippe Bruhat. LICENSE
This module is free software; you can redistribute it or modify it under the same terms as Perl itself. perl v5.12.4 2011-07-03 HTTP::Proxy::Engine(3pm)

Check Out this Related Man Page

HTTP::Proxy::BodyFilter::complete(3pm)			User Contributed Perl Documentation		    HTTP::Proxy::BodyFilter::complete(3pm)

NAME
HTTP::Proxy::BodyFilter::complete - A filter that passes on a complete body or nothing SYNOPSIS
use HTTP::Proxy; use HTTP::Proxy::BodyFilter::simple; use HTTP::Proxy::BodyFilter::complete; my $proxy = HTTP::Proxy->new; # pass the complete response body to our filter (in one pass) $proxy->push_filter( mime => 'text/html', response => HTTP::Proxy::BodyFilter::complete->new, response => HTTP::Proxy::BodyFilter::simple->new( sub { my ( $self, $dataref, $message, $protocol, $buffer ) = @_; # some complex processing that needs # the whole response body } ); ); $proxy->start; DESCRIPTION
The HTTP::Proxy::BodyFilter::complete filter will ensure that the next filter in the filter chain will only receive complete message bodies (either request or response). It will store the chunks of data as they arrive, only to pass the entire message body after the whole message has been received by the proxy. Subsequent filters is the chain will receive the whole body as a big piece of data. CAVEAT EMPTOR
This consumes memory and time. Use with caution, otherwise your client will timeout, or your proxy will run out of memory. Also note that all filters after "complete" are still called when the proxy receives data: they just receive empty data. They will receive the complete data when the filter chain is called for the very last time (the $buffer parameter is "undef"). (See the documentation of HTTP::Proxy::BodyFilter for details about the $buffer parameter.) METHOD
This filter defines two methods, called automatically: filter() Stores the incoming data in memory until the last moment and passes empty data to the subsequent filters in the chain. They will receive the full body during the last round of filter calls. will_modify() This method returns a false value, thus indicating to the system that it will not modify data passing through. AUTHOR
Philippe "BooK" Bruhat, <book@cpan.org>. THANKS
Thanks to Simon Cozens and Merijn H. Brandt, who needed this almost at the same time. ";-)" COPYRIGHT
Copyright 2004-2008, Philippe Bruhat. LICENSE
This module is free software; you can redistribute it or modify it under the same terms as Perl itself. perl v5.12.4 2011-07-03 HTTP::Proxy::BodyFilter::complete(3pm)
Man Page