4
4
use warnings FATAL => 'all';
6
use base qw(Apache::Filter); #so we inherit MODIFY_CODE_ATTRIBUTES
6
use base qw(Apache2::Filter); #so we inherit MODIFY_CODE_ATTRIBUTES
8
use Apache::RequestRec ();
9
use Apache::RequestIO ();
8
use Apache2::RequestRec ();
9
use Apache2::RequestIO ();
10
10
use APR::Brigade ();
11
11
use APR::Bucket ();
13
use Apache::Const -compile => qw(OK M_POST);
13
use TestCommon::Utils ();
15
use Apache2::Const -compile => qw(OK M_POST);
14
16
use APR::Const -compile => ':common';
16
18
sub handler : FilterRequestHandler {
17
19
my($filter, $bb, $mode, $block, $readbytes) = @_;
20
my $ba = $filter->r->connection->bucket_alloc;
22
my $ctx_bb = APR::Brigade->new($filter->r->pool, $ba);
24
my $rv = $filter->next->get_brigade($ctx_bb, $mode, $block, $readbytes);
26
if ($rv != APR::SUCCESS) {
30
while (!$ctx_bb->empty) {
32
my $bucket = $ctx_bb->first;
36
if ($bucket->is_eos) {
38
$bb->insert_tail($bucket);
42
my $status = $bucket->read($data);
43
#warn "DATA bucket!!!!";
44
if ($status != APR::SUCCESS) {
21
$filter->next->get_brigade($bb, $mode, $block, $readbytes);
23
for (my $b = $bb->first; $b; $b = $bb->next($b)) {
27
if ($b->read(my $data)) {
50
$bucket = APR::Bucket->new(scalar reverse $data);
29
my $nb = APR::Bucket->new($bb->bucket_alloc, scalar reverse $data);
30
$b->insert_before($nb);
53
$bb->insert_tail($bucket);
62
42
$r->content_type('text/plain');
64
if ($r->method_number == Apache::M_POST) {
65
my $data = ModPerl::Test::read_post($r);
44
if ($r->method_number == Apache2::Const::M_POST) {
45
my $data = TestCommon::Utils::read_post($r);
69
$r->puts("1..1\nok 1\n");
49
$r->puts("1..3\nok 1\n");