[cgiapp] can't search or edit the wiki; CGI::Simple difference

Mark Rajcok mrajcok at gmail.com
Mon Nov 16 12:14:53 EST 2009


I get errors if I try to search or edit the wiki, e.g.
  http://cgi-app.org/index.cgi?action=edit&page_name=CGIpmAlternatives

I sent email to webmaster at erlbaum.net but it bounced.


I wanted to make a note on the wiki about a difference I found between
CGI::Simple and normal CGI.
I'm using apache mod_rewrite and PATH_INFO to get "clean URLs", e.g.
 http://mysite.com/account/edit
turns into a call to account.cgi, and runmode "edit" is executed.

I was also guarding against cross site scripting by doing something like the
following
sub edit {
   ...
   if($self->query->url_param > 0)  {  error condition, looks like x-site
scripting }

With CGI::Simple, the above works.

I recently switched over to Fast::CGI and following the wiki instructions
  http://cgi-app.org/index.cgi?FastCGI
I'm no longer using CGI::Simple.

The above "if" statement started triggering in my unit test code.

url_param() is returning a parameter named "keywords".  I finally tracked
this down to "If the script was invoked as an <ISINDEX> script and contains
a string without ampersands (e.g. "value1+value2+value3") , there will be a
single parameter named "keywords" containing the "+"-delimited keywords."

I guess this is because I'm using PATH_INFO... not sure.  CGI::Simple
doesn't return a "keywords" param, but CGI.pm does.

So, the fix is
   if($self->query->url_param > 1)  {  error condition }
    # note, param "keywords" is present when using CGI.pm, but not when
using CGI::Simple

-- Mark


More information about the cgiapp mailing list