Apache2-ModProxyPerlHtml
view release on metacpan or search on metacpan
- Move project to CPAN.
30 Apr 2008 - version 2.3
- Fix parsing/replacement of CSS url called without quote, ex:
<@import url(http://server/file.css);>.
Thanks to Arthur LUTZ for the report.
23 May 2007 - version 2.2
- Fix parsing of javascript code using escaped quote.
ex: window.open("http://www.mydomain.com");
Thanks to Viesturs Ducens for the report.
20 Mar 2007 - Version 2.1
- Fix meta refresh parsing
- Fix misshandling of ProxyHTMLVerbose value
- Fix base href replacement using fully qualified URL
- Now support Http compression.
ModProxyPerlHtml.pm view on Meta::CPAN
my %replace_fct = ();
while ($$data =~ s/(\.replace\([^,]+,[^\)]+\))/\%\%REPLACE$i\%\%/) {
$replace_fct{$i} = $1;
$i++;
}
$$data =~ s/([^\\\/]['"])($replacement|$pattern)([^'"]*['"])/$1$replacement$3/ig;
$$data =~ s/\%\%REPLACE(\d+)\%\%/$replace_fct{$1}/g;
# Some use escaped quote - Do you have better regexp ?
$$data =~ s/(\")($replacement|$pattern)(.*\")/$1$replacement$3/ig;
# Try to set a fully qualified URI
$uri =~ s/$replacement.*//;
# Replace meta refresh URLs
$$data =~ s/(<meta\b[^>]+content=['"]*.*url=)($replacement|$pattern)([^>]+)/$1$uri$replacement$3/i;
# Replace base URI
$$data =~ s/(<base\b[^>]+href=['"]*)($replacement|$pattern)([^>]+)/$1$uri$replacement$3/i;
# CSS have url import call, most of the time not quoted
ModProxyPerlHtml.pm view on Meta::CPAN
In some conditions javascript code can be replaced by error, for example:
imgUp.src = '/images/' + varPath + '/' + 'up.png';
will be rewritten like this:
imgUp.src = '/URL/images/' + varPath + '/URL/' + 'up.png';
To avoid the second replacement, write your JS code like that:
imgUp.src = '/images/' + varPath + unescape('%2F') + 'up.png';
ModProxyPerlHTML replacement is activated on certain HTTP Content Type. If you
experienced that replacement is not activated for your file type, you can use the
ProxyHTMLContentType configuration directive to redefined the HTTP Content Type
that should be parsed by ModProxyPerlHTML. The default value is the following
Perl regular expresssion:
PerlAddVar ProxyHTMLContentType (text\/javascript|text\/html|text\/css|text\/xml|application\/.*javascript|application\/.*xml)
If you know exactly what you are doing by editing this regexp fill free to add
example:
imgUp.src = '/images/' + varPath + '/' + 'up.png';
will be rewritten like this:
imgUp.src = '/URL/images/' + varPath + '/URL/' + 'up.png';
To avoid the second replacement, write your JS code like that:
imgUp.src = '/images/' + varPath + unescape('%2F') + 'up.png';
ModProxyPerlHTML replacement is activated on certain HTTP Content Type.
If you experienced that replacement is not activated for your file type,
you can use the ProxyHTMLContentType configuration directive to
redefined the HTTP Content Type that should be parsed by
ModProxyPerlHTML. The default value is the following Perl regular
expresssion:
PerlAddVar ProxyHTMLContentType (text\/javascript|text\/html|text\/css|text\/xml|application\/.*javascript|application\/.*xml)
( run in 0.521 second using v1.01-cache-2.11-cpan-c21f80fb71c )