Re: Bug - Strange issue with mod_perl 2.0.10 / Apache 2.4 corrupting nfreeze data

Vincent Veyron <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Sun, 07 Aug 2016 14:37:28 +0100
Alex Masidlover <[email protected]> wrote:
> 
> Thanks for the suggestion - its taken a while but I've manage to free
> up a machine to roll forwards and test on; unfortunately I've got no
> experience with Apache and filters. I've come up with this:
> 
> package Zymonic::Decryptor::Filter;
> use strict;
> 
> use base qw(Apache2::Filter);
> use Encode qw(decode);
> use constant BUFF_LEN => 1024;
> use Apache2::Const -compile => 'OK';
> 
> sub utf8_filter : FilterRequestHandler {
> 
> my $f = shift;
> 
> my $content = '';
> while($f->read(my $buffer, BUFF_LEN)) {
> $content .= decode_utf8($buffer);
> }
> 
> $f->print($content);
> 
> return Apache2::Const::OK;
> 
> }
> 
> but when I add it with:
> 
> PerlOutputFilterHandler Zymonic::Decryptor::Filter::utf8_filter
> 
> 
> I get:
> 
> :Apache2 IO flush: (500) Unknown error 500 at -e line 0
> 
> in the Apache error log whenever I hit the server with a request.
> 
> I'm guessing I've done something very wrong with the filter, but I can
> find very few examples of how to use Apache2::Filter.
> 

I use the streaming filter. Try the recipe for package Apache::HijackFull; (page 13) in :

http://www.modperlcookbook.org/~geoff/slides/WUC/2005/mp2_filters-printable.pdf

(you need to check for seen_eos to print)

This is my code :

http://pastebin.com/dEWqdtsR

Note that I had to place Encode::decode_utf8 inside the 'if ($f->seen_eos)' block

-- 

					Bien à vous, Vincent Veyron

https://marica.fr/
Gestion des sinistres assurances, des dossiers contentieux et des contrats pour le service juridique
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.