1HTTP::Proxy::HeaderFiltUesre(r3)Contributed Perl DocumenHtTaTtPi:o:nProxy::HeaderFilter(3)
2
3
4

NAME

6       HTTP::Proxy::HeaderFilter - A base class for HTTP message header
7       filters
8

SYNOPSIS

10           package MyFilter;
11
12           use base qw( HTTP::Proxy::HeaderFilter );
13
14           # changes the User-Agent header in all requests
15           # this filter must be pushed on the request stack
16           sub filter {
17               my ( $self, $headers, $message ) = @_;
18
19               $message->headers->header( User_Agent => 'MyFilter/1.0' );
20           }
21
22           1;
23

DESCRIPTION

25       The HTTP::Proxy::HeaderFilter class is used to create filters for HTTP
26       request/response headers.
27
28   Creating a HeaderFilter
29       A HeaderFilter is just a derived class that implements some methods
30       called by the proxy. Of all the methods presented below, only
31       "filter()" must be defined in the derived class.
32
33       filter()
34           The signature of the "filter()" method is the following:
35
36               sub filter { my ( $self, $headers, $message) = @_; ... }
37
38           where $self is the filter object, $headers is a HTTP::Headers
39           object, and $message is either a HTTP::Request or a HTTP::Response
40           object.
41
42           The $headers HTTP::Headers object is the one that will be sent to
43           the client (if the filter is on the response stack) or origin
44           server (if the filter is on the request stack). If $headers is
45           modified by the filter, the modified headers will be sent to the
46           client or server.
47
48           The "init()" method (if it exists) is called by the "new()"
49           constructeur to perform all initisalisation tasks. It's called once
50           in the filter lifetime.
51
52           A HTTP::Proxy::HeaderFilter object is a blessed hash, and the base
53           class reserves only hash keys that start with "_hphf".
54
55       new()
56           The constructor is defined for all subclasses. Initialisation tasks
57           (if any) for subclasses should be done in the "init()" method (see
58           below).
59
60       init()
61           This method is called by the "new()" constructeur to perform all
62           initisalisation tasks. It's called once in the filter lifetime.
63
64           It receives all the parameters passed to "new()".
65
66   Standard HeaderFilters
67       Standard HTTP::Proxy::HeaderFilter classes are lowercase.
68
69       The following HeaderFilters are included in the HTTP::Proxy
70       distribution:
71
72       simple
73           This class lets you create a simple header filter from a code
74           reference.
75
76       standard
77           This is the filter that provides standard headers handling for
78           HTTP::Proxy.  It is loaded automatically by HTTP::Proxy.
79
80       Please read each filter's documentation for more details about their
81       use.
82

USEFUL METHODS FOR SUBCLASSES

84       Some methods are available to filters, so that they can eventually use
85       the little knowledge they might have of HTTP::Proxy's internals. They
86       mostly are accessors.
87
88       proxy()
89           Gets a reference to the HTTP::Proxy objects that owns the filter.
90           This gives access to some of the proxy methods.
91

AUTHOR

93       Philippe "BooK" Bruhat, <book@cpan.org>.
94

SEE ALSO

96       HTTP::Proxy, HTTP::Proxy::BodyFilter.
97
99       Copyright 2003-2015, Philippe Bruhat.
100

LICENSE

102       This module is free software; you can redistribute it or modify it
103       under the same terms as Perl itself.
104
105
106
107perl v5.28.1                      2015-06-16      HTTP::Proxy::HeaderFilter(3)
Impressum