diff --git a/docs/upgrades/upgrade_5.1.2-5.2.0.pl b/docs/upgrades/upgrade_5.1.2-5.2.0.pl
index e83fb6383..c332ceb31 100644
--- a/docs/upgrades/upgrade_5.1.2-5.2.0.pl
+++ b/docs/upgrades/upgrade_5.1.2-5.2.0.pl
@@ -124,4 +124,5 @@ print "\tRemoving unneeded files.\n" unless ($quiet);
unlink("../../sbin/Hourly/SyndicatedContent.pm");
unlink("../../sbin/imageCollateralImport.pl");
+unlink("../../lib/WebGUI/ProxyParse.pm");
diff --git a/lib/WebGUI/ProxyParse.pm b/lib/WebGUI/ProxyParse.pm
deleted file mode 100644
index 00bbb6054..000000000
--- a/lib/WebGUI/ProxyParse.pm
+++ /dev/null
@@ -1,103 +0,0 @@
-# Len Kranendonk - 20021212
-
-package WebGUI::ProxyParse;;
-require HTML::Parser;
-require HTML::Entities;
-require URI::URL;
-use WebGUI::URL;
-use vars qw(@ISA);
-@ISA = qw(HTML::Parser);
-
-my %linkElements = # from HTML::Element.pm
- (
- body => 'background',
- base => 'href',
- a => 'href',
- img => [qw(src lowsrc usemap)], # lowsrc is a Netscape invention
- form => 'action',
-# input => 'src',
- 'link' => 'href', # need quoting since link is a perl builtin
- frame => 'src',
- applet => 'codebase',
- area => 'href',
- );
-
-my %tag_attr;
-for my $tag (keys %linkElements) {
- my $tagval = $linkElements{$tag};
- for my $attr (ref $tagval ? @$tagval : $tagval) {
- $tag_attr{"$tag $attr"}++;
- }
-}
-
-sub new {
- my $pack = shift;
- my $self = $pack->SUPER::new();
- $self->{Url} = shift;
- $self->{Content} = shift;
- $self->{wid} = shift;
- $self->{Filtered} ="";
- $self->{FormAction} = "";
- $self->{FormActionIsDefined} = 0;
- $self;
-}
-
-sub filter {
- my $self=shift;
- $self->parse($self->{Content}); # Make paths absolute and let them return to us
- $self->eof;
- return $self->{Filtered};
-}
-
-## some items stolen from HTML::Filter
-sub output { $_[0]->{Filtered} .= $_[1]; }
-sub declaration { $_[0]->output("") }
-sub comment { $_[0]->output("") }
-sub text { $_[0]->output($_[1]) }
-sub end { $_[0]->output("$_[1]>") }
-
-sub start {
- my $self = shift;
- my ($tag, $attr, $attrseq, $origtext) = @_;
- $self->output("<$tag");
- for (keys %$attr) {
- $self->output(" $_=\"");
- my $val = $attr->{$_};
- if ((lc($tag) eq "input" || lc($tag) eq "textarea" || lc($tag) eq "select")
- && (lc($_) eq "name" || lc($_) eq "submit")) { # Rewrite input type names
- $val = 'HttpProxy_' . $val;
- }
- if (lc($tag) eq "form" && not $self->{FormActionIsDefined}) {
- $self->{FormAction} = $self->{Url};
- }
- if ($tag_attr{"$tag $_"}) { # needs rewrite
- if ($val =~ /^\?/) { # link that starts with ? i.e.
- my @urlBase = split(/\?/, $self->{Url});
- $val = URI::URL::url($urlBase[0] . $val);
- } else {
- $val = URI::URL::url($val)->abs($self->{Url},1); # make absolute
- }
- if ($val->scheme eq "http") {
- if (lc($tag) ne "img") { # no rewrite for images
- if (lc($tag) eq "form" && lc($_) eq "action") { # Found FORM ACTION
- $self->{FormActionIsDefined}=1;
- $self->{FormAction} = $val; # set FormAction to include hidden field later
- $val = WebGUI::URL::page; # Form Action returns to us
- } else {
- $val = WebGUI::URL::page('proxiedUrl='.WebGUI::URL::escape($val).
- '&wid='.$self->{wid}); # return to us
- }
- }
- }
- }
- $self->output($val.'"');
- }
- $self->output(">");
- if ($self->{FormAction} ne "") {
- $self->output('');
- $self->output('');
- $self->{FormAction} = '';
- $self->{FormActionIsDefined}=0;
- }
-}
-1;
diff --git a/lib/WebGUI/Wobject/HttpProxy.pm b/lib/WebGUI/Wobject/HttpProxy.pm
index 123f88337..991c10c73 100644
--- a/lib/WebGUI/Wobject/HttpProxy.pm
+++ b/lib/WebGUI/Wobject/HttpProxy.pm
@@ -22,7 +22,7 @@ use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Wobject;
-use WebGUI::ProxyParse;
+use WebGUI::Wobject::HttpProxy::Parse;
our @ISA = qw(WebGUI::Wobject);
@@ -231,7 +231,7 @@ sub www_view {
if($response->content_type eq "text/html" ||
($response->content_type eq "" && $content=~/new($proxiedUrl, $content, $_[0]->get("wobjectId"));
+ my $p = WebGUI::Wobject::HttpProxy::Parse->new($proxiedUrl, $content, $_[0]->get("wobjectId"));
$content = $p->filter; # Rewrite content. (let forms/links return to us).
$p->DESTROY;
diff --git a/lib/WebGUI/Wobject/HttpProxy/Parse.pm b/lib/WebGUI/Wobject/HttpProxy/Parse.pm
new file mode 100644
index 000000000..9b7c7d83e
--- /dev/null
+++ b/lib/WebGUI/Wobject/HttpProxy/Parse.pm
@@ -0,0 +1,141 @@
+package WebGUI::Wobject::HttpProxy::Parse;
+
+
+# -------------------------------------------------------------------
+# WebGUI is Copyright 2001-2003 Plain Black LLC.
+# -------------------------------------------------------------------
+# Please read the legal notices (docs/legal.txt) and the license
+# (docs/license.txt) that came with this distribution before using
+# this software.
+# -------------------------------------------------------------------
+# http://www.plainblack.com info@plainblack.com
+# -------------------------------------------------------------------
+
+
+use HTML::Parser;
+use HTML::Entities;
+use URI::URL;
+use WebGUI::URL;
+use vars qw(@ISA);
+@ISA = qw(HTML::Parser);
+
+
+
+my %linkElements = # from HTML::Element.pm
+ (
+ body => 'background',
+ base => 'href',
+ a => 'href',
+ img => [qw(src lowsrc usemap)], # lowsrc is a Netscape invention
+ form => 'action',
+# input => 'src',
+ 'link' => 'href', # need quoting since link is a perl builtin
+ frame => 'src',
+ applet => 'codebase',
+ area => 'href',
+ );
+
+my %tag_attr;
+for my $tag (keys %linkElements) {
+ my $tagval = $linkElements{$tag};
+ for my $attr (ref $tagval ? @$tagval : $tagval) {
+ $tag_attr{"$tag $attr"}++;
+ }
+}
+
+
+sub new {
+ my $pack = shift;
+ my $self = $pack->SUPER::new();
+ $self->{Url} = shift;
+ $self->{Content} = shift;
+ $self->{wid} = shift;
+ $self->{Filtered} ="";
+ $self->{FormAction} = "";
+ $self->{FormActionIsDefined} = 0;
+ $self;
+}
+
+
+sub filter {
+ my $self=shift;
+ $self->parse($self->{Content}); # Make paths absolute and let them return to us
+ $self->eof;
+ return $self->{Filtered};
+}
+
+## some items stolen from HTML::Filter
+
+
+
+sub output {
+ $_[0]->{Filtered} .= $_[1];
+}
+
+
+sub declaration {
+ $_[0]->output("")
+}
+
+
+sub comment {
+ $_[0]->output("")
+}
+
+sub text {
+ $_[0]->output($_[1])
+}
+
+
+sub end {
+ $_[0]->output("$_[1]>")
+}
+
+
+sub start {
+ my $self = shift;
+ my ($tag, $attr, $attrseq, $origtext) = @_;
+ $self->output("<$tag");
+ for (keys %$attr) {
+ $self->output(" $_=\"");
+ my $val = $attr->{$_};
+ if ((lc($tag) eq "input" || lc($tag) eq "textarea" || lc($tag) eq "select")
+ && (lc($_) eq "name" || lc($_) eq "submit")) { # Rewrite input type names
+ $val = 'HttpProxy_' . $val;
+ }
+ if (lc($tag) eq "form" && not $self->{FormActionIsDefined}) {
+ $self->{FormAction} = $self->{Url};
+ }
+ if ($tag_attr{"$tag $_"}) { # needs rewrite
+ if ($val =~ /^\?/) { # link that starts with ? i.e.
+ my @urlBase = split(/\?/, $self->{Url});
+ $val = URI::URL::url($urlBase[0] . $val);
+ } else {
+ $val = URI::URL::url($val)->abs($self->{Url},1); # make absolute
+ }
+ if ($val->scheme eq "http") {
+ if (lc($tag) ne "img") { # no rewrite for images
+ if (lc($tag) eq "form" && lc($_) eq "action") { # Found FORM ACTION
+ $self->{FormActionIsDefined}=1;
+ $self->{FormAction} = $val; # set FormAction to include hidden field later
+ $val = WebGUI::URL::page; # Form Action returns to us
+ } else {
+ $val = WebGUI::URL::page('proxiedUrl='.WebGUI::URL::escape($val).
+ '&wid='.$self->{wid}); # return to us
+ }
+ }
+ }
+ }
+ $self->output($val.'"');
+ }
+ $self->output(">");
+ if ($self->{FormAction} ne "") {
+ $self->output('');
+ $self->output('');
+ $self->{FormAction} = '';
+ $self->{FormActionIsDefined}=0;
+ }
+}
+
+
+1;