Accessing CGI Program

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email

What does the server do when it receives a request to run a CGI program? The client has no way of knowing that the user wants to access a CGI program fact, the client never knows the type of request the user is making. When the browser sends the request, it makes no difference to the browser vvhether the user wants to receive an image file or an audio file or the HTML output of a C program. When the browser receives a response, then it is important to know the data type of the information so that the browser can display it properly.

The server must determine whether the request is for a CGI program or not, and then take the appropriate action. Servers can determine whether a request is'.a CGI program in several different ways largely dependent on the server platform common way is for the server to check the directory of the request. some (such as the NCSA server) assume that any requests for items in the cgi bin directory are requests for CGI programs. Another common method is!,, look at the extension of the data requested: many servers assume that programs that end in the extension cgi are CGI programs.

The server cannot assume that the document requested is a CGI program eve, if the request is embedded in a form. For example, suppose you have the following form:

<html><head>
<title>Form</title>
</head>
<body>
<form action="/index.html" method=POST>
Name:<input name="name">
</form>
</body>
</html>

When this form is submitted, the server receives a request to post the input to the file /index. html. It cannot assume that/index.html is a CGI program; otherwise, it will try and run /index.html and will fail. Instead, it first looks at the URI and determines whether the URL specifies a CGI program or not. In this case, the server realizes it doesn't and sends an error message back to the browser stating that you cannot post to a file.



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.