Problem with CGI::escapeHTML and PerlEx?
by David Hempy other posts by this author
Oct 8 2004 11:47PM messages near this date
PerlEx future - update
|
RE: Regarding PerlEx End-of-Life Notification
--=====================_102244439==.ALT
Content-Type: text/plain; charset="us-ascii"
I've got a peculiar problem with my .aspl pages. If I call CGI::escapeHTML(), I loose my PO
ST parameters on all but the first invocation of the script.
You can see this in action on these two pages:
This page doesn't call escapeHTML(), and works fine:
http://webtools.ket.org/test/post_good.aspl
This page is identical, except it uses escapeHTML(), and it fails:
http://webtools.ket.org/test/post_bad.aspl
Below is the entire post_bad.aspl file. post_god.aspl is virtually the same, except for the
one line that calls escapeHTML().
Any ideas? I'm working around this, which is no big deal...but I'm worried that I may be tr
eating the symptom (eliminating my use of escapeHTML) without understanding the cause.
<%
$| = 1; # No output buffering.
$ENV{PATH}='';
use strict;
use CGI;
my $cgi = new CGI;
use Data::Dumper;
print "<pre> Dumping cgi object:\n" . (Dumper($cgi)) . "\n</pre>\n";
my $id = $cgi-> param('id');
%>
<html>
<head>
<title> ID is [<%=$id%>]</title>
</head>
<body>
<p>
The post_good script does not call CGI::escapeHTML(). <br>
You'll find that you can GET and POST
values all day long with no troubles.
</p>
<p>
The post_bad script calls CGI::escapeHTML(). <br>
You'll find that you can GET with no trouble,
but when you POST data, only the first POST after reloading PerlEx sees any
post parameters.
</p>
<h1>
You entered id=[<%=$id%> ]
</h1>
<p>
CGI::escapeHTML($id) yields: [<% print (CGI::escapeHTML($id)); %> ]
</p>
<form action="post_bad.aspl" method="post">
<input type="text" name="id" value="<%= $id %> " >
<input type="submit" value="Via POST">
</form>
<form action="post_bad.aspl" method="get">
<input type="text" name="id" value="<%= $id %> " >
<input type="submit" value="Via GET">
</form>
<form action="post_bad.aspl" method="get">
<input type="submit" name="reload" value="Reload PerlEx">
<%
if ($cgi-> param('reload')) {
PerlEx::ReloadAll();
print "<i> Reloading all PerlEx instances...</i><br>\n";
}
%>
</form>
<ul>
<li> <a href="post_good.aspl">post_good.aspl</a> - This version does NOT cal
l escapeHTML </li>
<li> <a href="post_bad.aspl">post_bad.aspl</a> - This version calls escapeHT
ML </li>
</ul>
</body>
</html>
--
David Hempy
Internet Database Administrator
Kentucky Educational Television
(859)258-7164 - (800)333-9764
A firm grip on reality is not a critical component of happiness.
--=====================_102244439==.ALT
Content-Type: text/html; charset="us-ascii"
<html>
<body>
<br>
I've got a peculiar problem with my .aspl pages. If I call
CGI::escapeHTML(), I loose my POST parameters on all but the first
invocation of the script. <br> <br>
You can see this in action on these two pages:<br> <br>
This page doesn't call escapeHTML(), and works fine:<br>
<a href="http://webtools.ket.org/test/post_good.aspl" eudora="autourl"> http://webtools.ket.o
rg/test/post_good.aspl</a> <br><br>
This page is identical, except it uses escapeHTML(), and it fails:<br>
<a href="http://webtools.ket.org/test/post_bad.aspl" eudora="autourl"> http://webtools.ket.or
g/test/post_bad.aspl</a> <br><br>
<br> <br>
<br>
Below is the entire post_bad.aspl file. post_god.aspl is virtually
the same, except for the one line that calls escapeHTML().<br> <br>
<br>
Any ideas? I'm working around this, which is no big deal...but I'm
worried that I may be treating the symptom (eliminating my use of
escapeHTML) without understanding the cause.<br> <br>
<br>
<%<br>
<x-tab> </x-tab>$| =
1;<x-tab> </x-tab># No output buffering.<br>
<x-tab> </x-tab>$ENV{PATH}='';<br>
<x-tab> </x-tab>use
strict;<br>
<x-tab> </x-tab>use
CGI;<br>
<x-tab> </x-tab>my $cgi =
new CGI;<br> <br>
<br>
<x-tab> </x-tab>use
Data::Dumper;<br>
<x-tab> </x-tab>print
"<pre>Dumping cgi object:\n" . (Dumper($cgi)) .
"\n</pre>\n";<br> <br>
<x-tab> </x-tab>my $id =
$cgi->param('id');<br>
%><br> <br>
<html><br>
<head><br>
<x-tab> </x-tab><title>ID
is [<%=$id%>]</title><br>
</head><br> <br>
<body><br> <br>
<x-tab> </x-tab><p>
<br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> The
post_good script does not call CGI::escapeHTML(). <br><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> You'll
find that you can GET and POST <br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> values
all day long with no troubles. <br>
<x-tab> </x-tab></p><br>
<x-tab> </x-tab><br>
<x-tab> </x-tab><p>
<br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> The
post_bad script calls CGI::escapeHTML(). <br><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> You'll
find that you can GET with no trouble,<br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> but
when you POST data, only the first POST after reloading PerlEx sees any
post parameters.<br>
<x-tab> </x-tab></p><br><br>
<x-tab> </x-tab><h1><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> You
entered
id=[<%=$id%>]<x-tab> </x-tab><x-tab> &nb
sp; </x-tab> <br>
<x-tab> </x-tab></h1><br>
<x-tab> </x-tab><br>
<x-tab> </x-tab><p><br>
<x-tab> </x-tab>CGI::escapeHTML($id)
yields: [<% print (CGI::escapeHTML($id)); %>]<br>
<x-tab> </x-tab></p><br><br>
<x-tab> </x-tab><br>
<x-tab> </x-tab><form
action="post_bad.aspl" method="post"><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <input
type="text" name="id" value="<%= $id
%>" ><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <input
type="submit" value="Via POST"> <br>
<x-tab> </x-tab></form><x-tab> </x
-tab> <x-tab> </x-tab><x-tab>  
; </x-tab> <br>
<x-tab> </x-tab><br>
<x-tab> </x-tab><form
action="post_bad.aspl" method="get"><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <input
type="text" name="id" value="<%= $id
%>" ><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <input
type="submit" value="Via GET"> <br>
<x-tab> </x-tab></form><x-tab> </x
-tab> <x-tab> </x-tab><x-tab>  
; </x-tab> <br><br>
<x-tab> </x-tab><form
action="post_bad.aspl" method="get"><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <input
type="submit" name="reload" value="Reload
PerlEx"> <br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <%<br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <x-tab> </x
-tab> if
($cgi->param('reload')) {<br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <x-tab> </x
-tab> <x-tab> </x-tab>PerlEx::ReloadAll();<x-t
ab> </x-tab><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <x-tab> </x
-tab> <x-tab> </x-tab>print
"<i>Reloading all PerlEx
instances...</i><br>\n";<x-tab> </x-tab><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <x-tab> </x
-tab> }<br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> %><br>
<x-tab> </x-tab></form><x-tab> </x
-tab> <x-tab> </x-tab><x-tab>  
; </x-tab> <br><br>
<x-tab> </x-tab><ul><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <li>
<a href="post_good.aspl">post_good.aspl</a> - This
version does NOT call escapeHTML </li><br>
<x-tab> </x-tab><x-tab> &nbs
p; </x-tab> <li>
<a href="post_bad.aspl">post_bad.aspl</a> - This
version calls escapeHTML </li><br>
<x-tab> </x-tab></ul><br>
<x-tab> </x-tab><br>
</body><br>
</html><br> <br>
<br>
</body>
<br>
<br>
<div> -- </div>
<div> David Hempy </div>
<div> Internet Database Administrator</div>
<div> Kentucky Educational Television </div>
<div> (859)258-7164 - (800)333-9764</div>
<br>
<div> A firm grip on reality is not a critical component of
happiness.</div>
<br>
</html>
--=====================_102244439==.ALT--
Attachments:
unknown1
|