CGI and Perl

The Request

The server acknowledges the first part of the request. The client then sends the second part, and without waiting for a response, follows up with the third and final part of the request.


If you have an external modem, take note of the send and receive lights the next time you click on a link in your Web browser. TCP/IP handshaking overhead is responsible for much of the activity.

At this point, a TCP/IP connection has been established between your browser and the Web server, and the Web server has received an HTTP request from the browser. Contrary to what a casual observer sees, this request contains more than just what is typed in the URI field in your Web browser.

The browser takes the URI that you give it, and from it derives the address of the server to contact, contacts it, and sends it a request. There are actually two types of requests a browser can send: the older SimpleRequest and the newer FullRequest. Both types of requests have the same basic format, but the FullRequest is much more versatile. The SimpleRequest has the following format:


where GET is a method that basically asks the server to retrieve whatever data is identified by the <URI> element. It is important to note that if the <URI> element points to a CGI script or some other data-producing executable process, the output generated by running the script or the
process will be returned to the browser, not the contents of the script or the source code. The CrLf is your basic carriage return followed by a linefeed sequence.

The GET and POST methods are by far the most commonly used methods and will be discussed in more detail in the "Methods" section. With the new FullRequest scheme, methods other than GET and POST are now possible. Also, additional headers may be appended to the request. The FullRequest has the following format:

METHOD <URI> "HTTP/1.1"    CrLf
 name: value            CrLf
 name: value            CrLf

where METHOD is one of the methods discussed in the "Methods" section and <URI> is the specified URI. The name: value header will likely be one of the headers discussed below. Methods The methods in Table 5.1 are included, or proposed for inclusion (at the time of this writing), in the current HTTP specification in a FullRequest.


Note that some of the methods described in Table 5.1 are not yet fully implemented in currently released browsers but are accessible by using or the HTTP::Request module. Fully elaborating on these methods is beyond the scope of this text. For more details on these methods, please consult the following URL:

by BrainBellupdated