1HTTP::Proxy::Engine(3)User Contributed Perl DocumentationHTTP::Proxy::Engine(3)
2
3
4

NAME

6       HTTP::Proxy::Engine - Generic child process manager engine for
7       HTTP::Proxy
8

SYNOPSIS

10           use HTTP::Proxy;
11
12           # use the default engine for your system
13           my $proxy = HTTP::Proxy->new();
14
15           # choose one
16           my $proxy = HTTP::Proxy->new( engine => 'Old' );
17

DESCRIPTION

19       The HTTP::Proxy::Engine class is a front-end to actual proxy engine
20       classes.
21
22       The role of an engine is to implement the main fork+serve loop with all
23       the required bookkeeping. This is also a good way to test various
24       implementation and/or try out new algorithms without too much
25       difficulties.
26

METHODS

28       new()
29           Create a new engine. The parameter "engine" is used to decide which
30           kind of engine will be created. Other parameters are passed to the
31           underlying engine.
32
33           This method also implement the subclasses constructor (they
34           obviously do not need the "engine" parameter).
35

CREATING YOUR OWN ENGINE

37       It is possible to create one's own engine, by creating a simple
38       subclass of HTTP::Proxy::Engine with the following methods:
39
40       start()
41           This method should handle any initialisation required when the
42           engine starts.
43
44       run()
45           This method is the main loop of the master process.  It defines how
46           child processes are forked, checked and killed.
47
48           The engine MUST have a run() method, and it will be called again
49           and again until the proxy exits.
50
51           "$self->proxy->daemon" returns the listening socket that can
52           "accept()" connections. The child must call
53           "$self->proxy->serve_connections()" on the returned socket to
54           handle actual TCP connections.
55
56       stop()
57           This optional method should handle any cleanup procedures when the
58           engine stops (typically when the main proxy process is killed).
59
60       A subclass may also define a %defaults hash (with "our") that contains
61       the default values for the fields used internaly.
62

METHODS PROVIDED TO SUBCLASSES

64       HTTP::Proxy::Engine provides the following methods to its subclasses:
65
66       proxy()
67           Return the HTTP::Proxy object that runs the engine.
68
69       max_clients()
70           Get or set the maximum number of TCP clients, that is to say the
71           maximum number of forked child process.
72
73           Some engines may understand a value of 0 as do not fork at all.
74           This is what HTTP::Proxy::Engine::Legacy does.
75
76       make_accessors( @names )
77           Create accessors named after @names in the subclass package.  All
78           accessors are read/write. This is a utility method.
79
80           This is a class method.
81

AUTHOR

83       Philippe "BooK" Bruhat, "<book@cpan.org>".
84
86       Copyright 2005-2015, Philippe Bruhat.
87

LICENSE

89       This module is free software; you can redistribute it or modify it
90       under the same terms as Perl itself.
91
92
93
94perl v5.32.0                      2020-07-28            HTTP::Proxy::Engine(3)
Impressum