Apache-RewritingProxy
view release on metacpan or search on metacpan
RewritingProxy.pm view on Meta::CPAN
$outString .= mainTextHandler($r,$tolkens->[1]);
}
# $outString .= $tolkens->[1];
}
elsif ($tolkens->[0] eq 'C')
{
# HTML COmments. Wrap them back in their comment tags and
# send em on to the browser...
$outString .= "<!-- ".$tolkens->[1]." -->";
}
elsif ($tolkens->[0] eq 'S' && ($tolkens->[1] eq 'a' ||
$tolkens->[1] eq 'A'))
{
$text = $tolkens->[4];
if ($tolkens->[2]{href})
{
my $newLink = &fixLink($r,$tolkens->[2]{href},$url);
$tolkens->[2]{href} = regexEscape($tolkens->[2]{href});
$text =~ s($tolkens->[2]{href})($newLink)gsx;
}
$outString .= $text;
}
elsif ($tolkens->[0] eq 'E')
{
$outString .= "</" . $tolkens->[1] . ">";
}
elsif ($tolkens->[1] =~ /^base$/i && $tolkens->[0] eq 'S')
{
$text = $tolkens->[4];
if ($tolkens->[2]{href})
{
my $newLink = &fixLink($r,$tolkens->[2]{href},$url);
$text =~ s#$tolkens->[2]{href}#$newLink#;
$url = $tolkens->[2]{href};
}
$outString .= $text;
}
elsif ($tolkens->[1] =~ /^meta$/i)
{
$text = $tolkens->[4];
if ($tolkens->[2]{content} =~ /url/i)
{
my ($junk,$tmpLink) = split (/=/, $tolkens->[2]{content});
my $newLink = &fixLink($r,$tmpLink,$url);
$tmpLink = regexEscape($tmpLink);
$text =~ s#$tmpLink#$newLink#;
}
$outString .= $text;
}
elsif ($tolkens->[1] =~ /^(area|link)$/i && $tolkens->[0] eq 'S')
{
$text = $tolkens->[4];
if ($tolkens->[2]{href})
{
my $newLink = &fixLink($r,$tolkens->[2]{href},$url);
$text =~ s#$tolkens->[2]{href}#$newLink#;
}
$outString .= $text;
}
elsif ($tolkens->[1] =~ /^(frame|img|input)$/i
&& $tolkens->[0] eq 'S')
{
$text = $tolkens->[4];
if ($tolkens->[2]{src} && $tolkens->[0] eq 'S')
{
my $newLink = &fixLink($r,$tolkens->[2]{src},$url);
$tolkens->[2]{src} = regexEscape($tolkens->[2]{src});
$text =~ s#$tolkens->[2]{src}#$newLink#;
}
$outString .= $text;
}
elsif ($tolkens->[1] =~ /^form$/i && $tolkens->[0] eq 'S')
{
$text = $tolkens->[4];
if ($tolkens->[2]{action})
{
my $newLink = &fixLink($r,$tolkens->[2]{action},$url);
my $action = regexEscape($tolkens->[2]{action});
$text =~ s#$action#$newLink#;
}
$outString .= $text;
}
elsif ($tolkens->[1] =~ /^(td|body)$/i && $tolkens->[0] eq 'S')
{
$text = $tolkens->[4];
if ($tolkens->[2]{background})
{
my $newLink = &fixLink($r,$tolkens->[2]{background},$url);
$text =~ s#$tolkens->[2]{background}#$newLink#;
}
$outString .= $text;
}
elsif ($tolkens->[1] =~ /^script$/i
&& $tolkens->[0] eq 'S')
{
$text = $tolkens->[4];
if ($tolkens->[2]{src} && $tolkens->[0] eq 'S')
{
my $newLink = &fixLink($r,$tolkens->[2]{src},$url);
$tolkens->[2]{src} = regexEscape($tolkens->[2]{src});
$text =~ s#$tolkens->[2]{src}#$newLink#;
}
$outString .= $text;
}
else
{
$outString .= $tolkens->[4];
}
}
$r->content_type($res->content_type);
print "\n" . $outString;
return(OK);
}
else
{
$r->content_type($res->content_type);
$r->header_out('Content-length'=> length($res->content));
print "\n" .$res->content;
return(OK);
( run in 2.037 seconds using v1.01-cache-2.11-cpan-df04353d9ac )