Apache-FilteringProxy
view release on metacpan or search on metacpan
lib/Apache/FilteringProxy.pm view on Meta::CPAN
$r->warn("filtering header '$name'='$value'") unless ($Apache::FilteringProxy::logging < 2);
if ($name =~ m/^(location|content-location|content-base|uri|refresh|)$/i) {
# filter redirects so we don't get shot off to a server not proxies
# by us unintentionally and any other data containing domains or URLs
my $val_ref = filter_data($r, \$value);
} elsif ($name =~ m/^content-type$/i) {
# here we are going to see if we need to translate any content-types
# since it is the easiest place to do it
my $content_type = "";
my $charset = "";
if (defined($value)) {
$content_type = $value;
if ($content_type =~ s/(;.*)//) {
$charset = $1;
}
}
$r->warn("determining if content-type '".$content_type."' needs to be translated...") unless ($Apache::FilteringProxy::logging < 1);
if (exists($Apache::FilteringProxy::type_translations{$content_type})) {
$r->warn("content-type '".$content_type."' needs to be translated") unless ($Apache::FilteringProxy::logging < 1);
if (defined($Apache::FilteringProxy::type_translations{$content_type})) {
$r->warn("caught and translated type '".$content_type.$charset."' to '".$Apache::FilteringProxy::type_translations{$content_type}.$charset."'") unless ($Apache::FilteringProxy::logging < 1);
$r->content_type($Apache::FilteringProxy::type_translations{$content_type}.$charset);
$value = $Apache::FilteringProxy::type_translations{$content_type}.$charset;
}
}
} elsif ($name =~ m/^set-cookie$/i) {
# set the domain for this cookie to our local domain so that we can
# intercept all these cookies and filter later
my $s = $r->server;
my $local_hostname = $r->hostname();
$local_hostname =~ m/.*(\.port(\d+))?\.([^.]+)\.$local_servername$/;
my $resource_id = $3;
my $port = $2 || "";
( run in 2.484 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )