Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

404 Not Found following CGI post action

by kleucht (Beadle)
on Aug 09, 2003 at 15:18 UTC ( [id://282423]=perlquestion: print w/replies, xml ) Need Help??

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

This is really wierd, since this script was working just fine last week and I can't figure out what I might have done to break it. The CGI script currently generates the main menu fine, but when the user clicks on a button from this main menu, the URL gets modified and the 404 error appears. I do not understand why the URL is getting modified! Please help!

Starting URL in browser window:
"http://www.leucht.com/pabc/pvst-dev/"
(Don't try to go there, it's password protected.)

Tiny snippet of my perl code using CGI module:

print $myCgi->start_form(); print "<center>\n"; print "<input type=hidden name=\"action\" value=\"StorySubmittal\">"; print "<input type=submit value=\"Story Submittal\">"; print "</center>\n"; print $myCgi->end_form();

Tiny snippet of HTML Source generated from above perl code (note the %2F's in the action field. Is that correct? I've never looked at the generated HTML code before. It's always just worked!):

<form method="post" action="%2F.%2Findex.cgi" enctype="application/x-w +ww-form-urlencoded"> <center> <input type=hidden name="action" value="StorySubmittal"> <input type=submit value="Story Submittal"> </center> <div></div></form>

When the user hits the "Story Submittal" button, the URL in the browser window changes to this:
"http://www.leucht.com/pabc/pvst-dev/%2Fpabc%2Fpvst-dev%2F"
This is obviously not a good URL!

This has never happened to me before in 5 years worth of writing CGI perl scripts! Did I do something stupid and just haven't realized it yet?!? Please help me, I need to get this script working again this weekend! My customers will not be very happy! :-)

Thanks in advance for any help you can give,
Kurt Leucht

Replies are listed 'Best First'.
Re: 404 Not Found following CGI post action
by jsprat (Curate) on Aug 09, 2003 at 17:05 UTC
      Thanks a ton! I will tell my provider!

      Kurt

Re: 404 Not Found following CGI post action
by kleucht (Beadle) on Aug 09, 2003 at 16:06 UTC
    From the original question submitter:

    Investigation (thanks for the help, atcroft!) reveals that if I force the action of the button to be "index.cgi" (second argument to the start_form routine), it works okay again. This should be the default action, so I don't understand why it broke in the first place.

    I have a workaround to make my customer happy, but I'd rather not see that index.cgi at the end of the URL, so I would still like to solve the root problem if at all possible.

    Advise is still appreciated,
    Kurt Leucht

Re: 404 Not Found following CGI post action
by bobn (Chaplain) on Aug 09, 2003 at 16:32 UTC

    the %2f is an encoding of a slash '/' - have no idea why that is happening, can only think that some part of your program is encoding part of your URL as if it were a query. I see you're running Apache on Redhat, with FrontPage. This is totally reaching, but FrontPage brings to mind MS, an environment where '/' is not the directory separator, so I wonder if that has anyting to do with it.

    --Bob Niederman, http://bob-n.com
      Thanks for the reply, Bob. The server may have FrontPage installed, but I do not use it. I write all my perl scripts using a text editor (EditPlus).

      Kurt

Re: 404 Not Found following CGI post action
by kleucht (Beadle) on Aug 09, 2003 at 16:51 UTC
    From the original submitter:

    Okay, so the %2F is a slash "/" character. I figured that was the case. But something still does not make any sense.

    1) The HTML source shows "/./index.cgi" as the action, but shouldn't it just be "./index.cgi"? Why the first slash?

    2) The URL after the button press shows "/pabc/pvst-dev/" appended to my original URL. Where did this come from? This was not in the action field of the HTML source? And why doesn't the browser see the first slash and use that as the root? That would actually be correct if it did that. I never upgraded my browser, so what is causing all this mess anyways?

    Any ideas?
    Kurt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-25 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found