fixed: HttpProxy parser now handles self-closing tags correctly

fixed: HttpProxy parser now only rewrites forms when also rewriting URLs
This commit is contained in:
Doug Bell 2008-09-23 16:26:19 +00:00
parent 3bc3de6c41
commit 10fba5dbc0
2 changed files with 15 additions and 3 deletions

View file

@ -84,6 +84,8 @@
- added: Default templates now show big warning message. All templates added via upgrade scripts
are set to be a "default" template.
- fixed: Utility script skeleton now more complete and less annoying
- fixed: HttpProxy parser now handles self-closing tags correctly
- fixed: HttpProxy parser now doesn't try to rewrite forms unless also rewriting URLs
7.5.22
- fixed: Layout template now gets prepared correctly

View file

@ -127,6 +127,9 @@ sub start {
my $self = shift;
my ($tag, $attr, $attrseq, $origtext) = @_;
# Set a flag for self-closing tags
my $selfclose;
# Check on the div class and div id attributes to see if we're proxying ourself.
if($tag eq "div" && $attr->{'class'} eq 'wobjectHttpProxy' && $attr->{'id'} eq ('assetId'.$self->{assetId})) {
$self->{recurseCheck} = 1;
@ -134,12 +137,12 @@ sub start {
$self->output("<$tag");
for (keys %$attr) {
if ($_ eq '/') {
$self->output('/');
$selfclose = 1;
next;
}
$self->output(" $_=\"");
my $val = $attr->{$_};
if ((lc($tag) eq "input" || lc($tag) eq "textarea" || lc($tag) eq "select")
if ( $self->{ rewriteUrls } && (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;
}
@ -187,8 +190,15 @@ sub start {
}
$self->output($val.'"');
}
# Close the tag
if ( $selfclose ) {
$self->output( " /" );
}
$self->output(">");
if ($self->{FormAction} ne "") {
# Prepare our form action if necessary
if ($self->{ rewriteUrls } && $self->{FormAction} ne "") {
$self->output('<input type="hidden" name="FormAction" value="'.$self->{FormAction}.'">');
$self->output('<input type="hidden" name="func" value="view">');
$self->{FormAction} = '';