package Book::InputRequestFilterLC; use strict; use warnings; use base qw(Apache::Filter); use Apache::Connection (); use APR::Brigade (); use APR::Bucket (); use Apache::Const -compile => 'OK'; use APR::Const -compile => ':common'; sub handler : FilterRequestHandler { my($filter, $bb, $mode, $block, $readbytes) = @_; my $c = $filter->c; my $bb_ctx = APR::Brigade->new($c->pool, $c->bucket_alloc); my $rv = $filter->next->get_brigade($bb_ctx, $mode, $block, $readbytes); return $rv unless $rv == APR::SUCCESS; while (!$bb_ctx->empty) { my $b = $bb_ctx->first; $b->remove; if ($b->is_eos) { $bb->insert_tail($b); last; } my $data; my $status = $b->read($data); return $status unless $status == APR::SUCCESS; $b = APR::Bucket->new(lc $data) if $data; $bb->insert_tail($b); } Apache::OK; } 1;