Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Path to scriptname in start_form()

by weini (Friar)
on Sep 15, 2003 at 07:20 UTC ( [id://291502]=perlquestion: print w/replies, xml ) Need Help??

weini has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I am not programming very often, so sorry for a dumb question ...

Using CGI.pm I create a form with the functions start_form() and end_form() - no problem here. The default parameters are allright for me.

My problem is that running the script on one webserver I get the right action="/~myname/cgi-bin/myscript.pl" while on another server it's changed to action="%2Fcgi-bin%2Fmyscript.pl" which causes an error in executing.

How can I make sure that the slashes are NOT converted to "%2F"?

Any clues? Thank you!
Weini

Replies are listed 'Best First'.
Re: Path to scriptname in start_form()
by PodMaster (Abbot) on Sep 15, 2003 at 07:29 UTC
    perldoc -f use
    $$ perl -Mblib=CGI.pm-2.56 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.56/blib <FORM METHOD="POST" ENCTYPE="application/x-www-form-urlencoded"> 2.56 at -e line 1. $$ perl -Mblib=CGI.pm-2.81 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.81/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.81 at -e line 1. $$ perl -Mblib=CGI.pm-2.84 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.84/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.84 at -e line 1. $$ perl -Mblib=CGI.pm-2.85 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.85/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.85 at -e line 1. $$ perl -Mblib=CGI.pm-2.86 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.86/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.86 at -e line 1. $$ perl -Mblib=CGI.pm-2.90 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.90/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.90 at -e line 1. $$ perl -Mblib=CGI.pm-2.91 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.91/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.91 at -e line 1. $$ perl -Mblib=CGI.pm-2.92 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.92/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.92 at -e line 1. $$ perl -Mblib=CGI.pm-2.93 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.93/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.93 at -e line 1. $$ perl -Mblib=CGI.pm-2.94 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.94/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.94 at -e line 1. $$ perl -Mblib=CGI.pm-2.95 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" CGI.pm-2.95 is not a directory BEGIN failed--compilation aborted. $$ perl -Mblib=CGI.pm-2.97 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.97/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.97 at -e line 1. $$ perl -Mblib=CGI.pm-2.98 -MCGI -e"warn CGI->start_form();die CGI->ve +rsion" Using CGI.pm-2.98/blib <form method="post" action="/-e" enctype="application/x-www-form-urlen +coded"> 2.98 at -e line 1. $$ perl -MCGI -e"warn CGI->start_form();die CGI->version" <form method="post" action="%2F-e" enctype="application/x-www-form-url +encoded"> 2.99 at -e line 1.
    CGI.pm's html generation functions are famous for this kind of thing. On a side node, I vaguely recall that apache, or some versions of it, do seem to interpret %2F as a / before a ?, so /a%2Fb/ is interpreted as /a/b/.

    I'm not sure what the RFCs say, so I suggest you find out what it's supposed to be, and then figure out if that's the wrong behaviour on behalf of CGI.pm.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      CGI.pm 2.99 is absolutely broken, thanks to a rushed patch to fix a cross-site scripting problem. 3.00 is fixed again, thanks to my corrected patch.

      Do not use CGI.pm 2.99 (it's broken), or any version prior to 2.99 (it has a cross-site scripting hole).

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

      Yep, that's it, thank you very much! I've downgraded the CGI and it works fine.

      Weini

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://291502]
Approved by jonnyfolk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-03-29 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found