Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Specifying .pl script in cgi-bin in html page

    Can someone explain why this doesn't work:
    <form method="get" action="http://cgi-bin/johnlabwk6.pl">
    ( I get server not found error when I hit submit button in form)
    and this does work:
    <form method="get" action="http:/cgi-bin/johnlabwk6.pl">
    The above line was in some html provided by the author of a text book.

    I have Apache2.2 on Windows and I am just learning about cgi. I searched for answers and didn't find anything but it would seem the typical way to specify the URI path in this case would be:
    <form method="get" action="/cgi-bin/johnlabwk6.pl">
    The above also works fine and I think I will modify the example from the book for the students I am teaching distributed programming concepts to - not just CGI. BTW my html page is in the standard location for Apache - htdocs.

    John Bundy

  2. #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    3,307
    Thanks
    2
    Thanked 229 Times in 222 Posts
    You're the instructor and don't understand URI's? I suspect that you're really one of the students.

    What text book are you using?

    Neither of the first two URI's should work, because they are missing the domain/authority.

    The third is a relative path on the local server, hence it does not require the scheme and authority.
    Last edited by FishMonger; 10-09-2011 at 04:21 PM.

  3. #3
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    The book is "Distributed Computing by M.L. Liu" but the examples I started with from the course shell were not exactly like the book - and they do work. The examples in the book have multiple errors.

    I agree I would expect a host in the URI like http:/cgi-bin/johnlabwk6.pl but that really does work. http://cgi-bin/johnlabwk6.pl does not work with the normal two slashes after http and I would like to know why it works with one slash. I assumed there is something going on because of the Apache cgi environment and I read that cgi-bin is an alias.

    I see other places on the internet where forms have a URI like:
    <H4><FORM METHOD="POST" ACTION="http:/cgi-bin/test/store.pl?edit">
    at
    http://www.aprelium.com/forum/viewtopic.php?t=5434

    Please someone answer my original question.

  4. #4
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    3,307
    Thanks
    2
    Thanked 229 Times in 222 Posts
    This is a case where the browser tries to interpret what you meant. Since the scheme is incomplete, the browser appears to ignore the http: portion and interpret the rest as the relative path as apposed to a fully qualified URI. This behavior should not be relied upon, since it's browser dependent and the next version of the same browser may not behave in the same manner.

  5. Users who have thanked FishMonger for this post:

    johnbundy100 (10-11-2011)

  6. #5
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    FishMonger - I conclude you are right. Thanks.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •