1
package TestFilter::both_str_native_remove;
3
# this tests verifies that we can remove input and output native
4
# (non-mod_perl filters)
7
use warnings FATAL => 'all';
9
use Apache2::RequestRec ();
10
use Apache2::RequestIO ();
12
use Apache2::Filter ();
13
use Apache2::FilterRec ();
17
use TestCommon::Utils ();
19
use Apache2::Const -compile => qw(OK DECLINED M_POST);
21
# this filter removes the next filter in chain and itself
25
my $args = $f->r->args || '';
26
if ($args eq 'remove') {
28
$ff->remove if $ff && $ff->frec->name eq 'includes';
33
return Apache2::Const::DECLINED;
36
# this filter removes the next filter in chain and itself
40
my $args = $f->r->args || '';
41
if ($args eq 'remove') {
42
for (my $ff = $f->r->input_filters; $ff; $ff = $ff->next) {
43
if ($ff->frec->name eq 'deflate') {
51
return Apache2::Const::DECLINED;
54
# this filter appends the output filter list at eos
60
$f->r->headers_out->unset('Content-Length');
63
while ($f->read(my $buffer, 1024)) {
68
my $flist = join ',', get_flist($f->r->output_filters);
69
$f->print("output2: $flist\n");
72
return Apache2::Const::OK;
80
my $x = $r->pnotes('INPUT_FILTERS') || [];
81
push @$x, join ',', get_flist($f->r->input_filters);
82
$r->pnotes('INPUT_FILTERS' => $x);
85
return Apache2::Const::DECLINED;
92
# just to make sure that print() won't flush, or we would get the
96
$r->content_type('text/plain');
97
if ($r->method_number == Apache2::Const::M_POST) {
98
$r->print("content: " . TestCommon::Utils::read_post($r) ."\n");
102
for (@{ $r->pnotes('INPUT_FILTERS')||[] }) {
103
$r->print("input$i: $_\n");
107
$r->subprocess_env(SSI_TEST => 'SSI OK');
108
$r->printf("output1: %s\n", join ',', get_flist($r->output_filters));
110
$r->rflush; # this sends the data in the buffer + flush bucket
111
$r->print('x<!--#echo var=');
112
$r->rflush; # this sends the data in the buffer + flush bucket
113
$r->print('"SSI_TEST" -->x'."\n");
122
for (; $f; $f = $f->next) {
123
push @flist, $f->frec->name;
133
PerlModule TestFilter::both_str_native_remove
134
PerlResponseHandler TestFilter::both_str_native_remove::response
135
PerlOutputFilterHandler TestFilter::both_str_native_remove::remove_includes
136
PerlSetOutputFilter INCLUDES
137
PerlOutputFilterHandler TestFilter::both_str_native_remove::print_out_flist
138
PerlInputFilterHandler TestFilter::both_str_native_remove::store_in_flist
139
PerlInputFilterHandler TestFilter::both_str_native_remove::remove_deflate
140
PerlSetInputFilter DEFLATE
141
PerlInputFilterHandler TestFilter::both_str_native_remove::store_in_flist