Mailing List Archive

[mp2] No data is read from Perl Output Filter
I am experimenting with ReverseProxy::FormFiller and stuck with output request rewriting. Nothing is read from filter, but filter is invoked.
Code below writes nothing into logs.
while ($f->read(my $buffer, 1024)) {
$body .= $buffer;
&logErrorSimple($f->r,"---------$body------$buffer-----");
}

There are always a few parameters are sent via POST during tests, but nothing can't be rewritten by the filter because nothing is read.
Re: [mp2] No data is read from Perl Output Filter [ In reply to ]
On Mon, 21 Nov 2016 16:23:22 -0500
"Vlad Liapko" <vliapko@gmail.com> wrote:

> I am experimenting with ReverseProxy::FormFiller and stuck with output request rewriting. Nothing is read from filter, but filter is invoked.
> Code below writes nothing into logs.
> while ($f->read(my $buffer, 1024)) {
> $body .= $buffer;
> &logErrorSimple($f->r,"---------$body------$buffer-----");
> }
>
> There are always a few parameters are sent via POST during tests, but nothing can't be rewritten by the filter because nothing is read.
>

I think you need to use something like :

while ($f->read(my $buffer, 1024)) {
$body .= $buffer;
}
if ($f->seen_eos) {
&logErrorSimple($f->r,"---------$body-----------");
}

You'll find relevant examples in:

http://perl.apache.org/docs/2.0/user/handlers/filters.html#C_PerlOutputFilterHandler_
http://modperlbook.org/html/25-3-I-O-Filtering.html

--
Bien à vous, Vincent Veyron

https://marica.fr/
Gestion des sinistres assurances, des dossiers contentieux et des contrats pour le service juridique