[CLUE-Tech] Perl Question
Jesse Flygare
email_sucks at hotmail.com
Tue Aug 5 16:28:17 MDT 2003
I am not quite sure I understand. I understand that some chars (like spaces)
need encoding for the server and browser to recognize a valid URL/URI. But
if the script is trying to encode a forward slash "/" for the sake of apache
and the browser, it is doing no good. The browser tries to send the form
data back to %2Fscriptdir%2Fscriptname.cgi and the server is chokeing on the
URL. Here is an example of exactly what is happening:
Here is the code:
#!/usr/bin/perl
# CGI to illustrate anomaly
$|=1;
use CGI;
$q = new CGI;
print $q->start_form,
$q->popup_menu(-name=>'item',
-values=>['one','two','three']),
$q->submit('send','Send'),
$q->end_form,
"\n<hr>\n",
$q->param('item'),
"\n";
On RH 9... execute the following from the command line:
./form.cgi item=one
here is the output:
<form method="post" action="%2F.%2Fform.cgi"
enctype="application/x-www-form-urlencoded">
<select name="item">
<option selected="selected" value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
</select><input type="submit" name="send" value="Send" /><div></div></form>
<hr>
one
On RH 7.3... execute the following command on the same code:
./form.cgi item=two
here is the output:
<form method="post" action="/./form.cgi"
enctype="application/x-www-form-urlencoded">
<select name="item">
<option value="one">one</option>
<option selected="selected" value="two">two</option>
<option value="three">three</option>
</select><input type="submit" name="send" value="Send" /></form>
<hr>
two
notice the "action=.." tag is the only variable that got translated. How do
I stop this?
----Original Message Follows----
From: Lynn Danielson <lynnd at techangle.com>
Reply-To: clue-tech at clue.denver.co.us
To: clue-tech at clue.denver.co.us
Subject: Re: [CLUE-Tech] Perl Question
Date: Tue, 05 Aug 2003 15:17:06 -0600
MIME-Version: 1.0
Received: from clue.denver.co.us ([199.239.19.17]) by
mc2-f9.law16.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Tue, 5 Aug
2003 14:19:14 -0700
Received: from clue.denver.co.us (IDENT:mailman at localhost.localdomain
[127.0.0.1])by clue.denver.co.us (8.9.3/8.9.3) with ESMTP id PAA16002;Tue, 5
Aug 2003 15:05:06 -0600
Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222])by
clue.denver.co.us (8.9.3/8.9.3) with ESMTP id PAA15983for
<clue-tech at clue.denver.co.us>; Tue, 5 Aug 2003 15:04:41 -0600
Received: from techangle.com (tux.ihs.com [170.207.55.1])by mail1.ihs.com
(8.12.9/8.12.9) with ESMTP id h75LF7MX029951for
<clue-tech at clue.denver.co.us>; Tue, 5 Aug 2003 15:15:07 -0600 (MDT)
X-Message-Info: UZmYcfFpTCewzfqvyl1d189+/FjrFUZX
Message-ID: <3F301ED2.1060000 at techangle.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030507
X-Accept-Language: en-us, en
References: <BAY2-F114Wd7Kkibfmy00003f2e at hotmail.com>
In-Reply-To: <BAY2-F114Wd7Kkibfmy00003f2e at hotmail.com>
X-MailScanner: Found to be clean
X-MailScanner-SpamCheck:
Sender: clue-tech-admin at clue.denver.co.us
Errors-To: clue-tech-admin at clue.denver.co.us
X-BeenThere: clue-tech at clue.denver.co.us
X-Mailman-Version: 2.0.11
Precedence: bulk
List-Help: <mailto:clue-tech-request at clue.denver.co.us?subject=help>
List-Post: <mailto:clue-tech at clue.denver.co.us>
List-Subscribe:
<http://clue.denver.co.us/mailman/listinfo/clue-tech>,<mailto:clue-tech-request at clue.denver.co.us?subject=subscribe>
List-Id: CLUE technical discussions,questions and answers.
<clue-tech.clue.denver.co.us>
List-Unsubscribe:
<http://clue.denver.co.us/mailman/listinfo/clue-tech>,<mailto:clue-tech-request at clue.denver.co.us?subject=unsubscribe>
List-Archive: <http://clue.denver.co.us/pipermail/clue-tech/>
Return-Path: clue-tech-admin at clue.denver.co.us
X-OriginalArrivalTime: 05 Aug 2003 21:19:17.0864 (UTC)
FILETIME=[3AA5CE80:01C35B97]
Jesse Flygare wrote:
>I am using RH 9 and just installed the CGI module from CPAN. I created a
>simple form script and noticed that the CGI functions are converting
>slashes (/) into hex (%2F) and it is messing up my scripts (for instance $0
>will return the script name and path as .%2Fscript.cgi instead of
>./script.cgi). Previous versions I have used do not do this. Does anyone
>know what is going on? How can I stop this conversion?
That's standard cgi encoding. Run your cgi functions on the form variables
portion
of your url only and append t to your script name. --Lynn
_______________________________________________
CLUE-Tech mailing list
Post messages to: CLUE-Tech at clue.denver.co.us
Unsubscribe or manage your options:
http://clue.denver.co.us/mailman/listinfo/clue-tech
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
More information about the clue-tech
mailing list