fixed [ 925586 ] HttpProxy ignores javascript in <HEAD> (solution provided)

This commit is contained in:
JT Smith 2004-04-19 19:50:52 +00:00
parent d05f088f5f
commit 6112f756b0
2 changed files with 10 additions and 7 deletions

View file

@ -16,6 +16,8 @@
- Macros are now negated on user profile fields and authentication
fields.
- Bugfix [ 930425 ] Bug in EventsCalender, causing other wobjects to fail.
- Bugfix [ 925586 ] HttpProxy ignores javascript in <HEAD> (thanks to
Nicklous Roberts).

View file

@ -47,9 +47,9 @@ These methods are available from this package:
=head2 cleanSegment ( html )
Returns an HTML segment that has been stripped of the <BODY> tag and anything before it, as well as the </BODY> tag and anything after it.
Returns an HTML segment that has been stripped of the <BODY> tag and anything before it, as well as the </BODY> tag and anything after it. It's main purpose is to get rid of META tags and other garbage from an HTML page that will be used as a segment inside of another page.
NOTE: This filter does have one exception, it leaves anything before the <BODY> tag that is enclosed in <STYLE></STYLE> tags.
NOTE: This filter does have one exception, it leaves anything before the <BODY> tag that is enclosed in <STYLE></STYLE> or <SCRIPT></SCRIPT> tags.
=over
@ -62,16 +62,17 @@ The HTML segment you want cleaned.
=cut
sub cleanSegment {
my ($style, $value);
$value = $_[0];
my $value = $_[0];
if ($value =~ s/\r/\n/g) {
$value =~ s/\n\n/\n/g
}
$value =~ m/(\<style.*?\/style\>)/ixsg;
$style = $1;
$value =~ s/\A.*?\<body.*?\>(.*?)/$style$1/ixsg;
my $style = $1;
$value =~ m/(\<script.*?\/script\>)/ixsg;
my $script = $1;
$value =~ s/\A.*?\<body.*?\>(.*?)/$1/ixsg;
$value =~ s/(.*?)\<\/body\>.*?\z/$1/ixsg;
return $value;
return $script.$style.$value;
}
#-------------------------------------------------------------------