From 10fba5dbc044840cd8e29e9a8bd71dc454ced9f3 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Tue, 23 Sep 2008 16:26:19 +0000 Subject: [PATCH] fixed: HttpProxy parser now handles self-closing tags correctly fixed: HttpProxy parser now only rewrites forms when also rewriting URLs --- docs/changelog/7.x.x.txt | 2 ++ lib/WebGUI/Asset/Wobject/HttpProxy/Parse.pm | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 6091f0f50..f0232cd94 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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 diff --git a/lib/WebGUI/Asset/Wobject/HttpProxy/Parse.pm b/lib/WebGUI/Asset/Wobject/HttpProxy/Parse.pm index 60d1877c8..bec18df84 100644 --- a/lib/WebGUI/Asset/Wobject/HttpProxy/Parse.pm +++ b/lib/WebGUI/Asset/Wobject/HttpProxy/Parse.pm @@ -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(''); $self->output(''); $self->{FormAction} = '';