Apache2-ModProxyPerlHtml
view release on metacpan or search on metacpan
ModProxyPerlHtml.pm view on Meta::CPAN
use warnings;
require mod_perl2;
use Apache2::Connection ();
use Apache2::RequestRec;
use Apache2::RequestUtil;
use APR::Table;
use APR::URI;
use base qw(Apache2::Filter);
use Apache2::Const -compile => qw(OK DECLINED :conn_keepalive);
use constant BUFF_LEN => 8000;
use Apache2::ServerRec;
use Apache2::URI;
$Apache2::ModProxyPerlHtml::VERSION = '4.1';
%Apache2::ModProxyPerlHtml::linkElements = (
'a' => ['href'],
ModProxyPerlHtml.pm view on Meta::CPAN
} else {
$ct->{rot13elements}->{$elt} = $attr;
}
}
$f->ctx($ct);
}
# Thing we do on all invocations
my $ctx = $f->ctx;
while ($f->read(my $buffer, BUFF_LEN)) {
$ctx->{data} .= $buffer;
$ctx->{keepalives} = $f->c->keepalives;
$f->ctx($ctx);
}
# Thing we do at end
if ($f->seen_eos) {
my $parsed_uri = $f->r->construct_url();
my $a_encoding = $f->r->headers_in->{'Accept-Encoding'} || '';
my $c_encoding = $f->r->headers_out->{'Content-Encoding'} || '';
my $ct = $f->r->headers_out->{'Content-type'} || '';
# Only proceed URLs that are not excluded from rewritter
ModProxyPerlHtml.pm view on Meta::CPAN
}
}
}
# Apply any change
$f->ctx($ctx);
# Dump datas out
$f->print($f->ctx->{data});
my $c = $f->c;
if ($c->keepalive == Apache2::Const::CONN_KEEPALIVE && $ctx->{data} && $c->keepalives > $ctx->{keepalives}) {
if ($debug) {
Apache2::ServerRec::warn("[ModProxyPerlHtml] Cleaning context for keep alive request");
}
$ctx->{data} = '';
$ctx->{pattern} = ();
$ctx->{rewrite} = ();
$ctx->{excluded} = ();
$ctx->{rot13elements} = ();
$ctx->{contenttype} = '';
$ctx->{badcontenttype} = '';
$ctx->{keepalives} = $c->keepalives;
}
}
return Apache2::Const::OK;
}
sub link_replacement
{
my ($data, $pattern, $replacement, $uri, $rot13elements) = @_;
( run in 0.637 second using v1.01-cache-2.11-cpan-df04353d9ac )