|
|
|
|
There are two basic methods for performing CGI queries:
(Actually, there are a number of additional methods, but we will ignore these others for the purposes of this discussion.) The CGI GET MethodThe protocol for an HTTP GET method is for the client to send a request message to the web server that looks something like: GET /images/logo.gif HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT) Host: www.rivier.edu Connection: Keep-Alive followed by a blank line. In the above GET request message, the first line requests a file logo.gif from the web server. The file is expected to be located in the images folder. If any CGI query string is present, it is appended to the URL in the first line. Problems with this include:
The lines following the first line, and preceding the blank line are Request Headers (one request header per line). The CGI POST MethodThe POST method attempts to solve these problems by moving the name/value pairs that comprise the query string into the main body of the request message: POST /cg-bin/queryProcessor HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT) Host: www.rivier.edu Connection: Keep-Alive name=Bryan college=Rivier Which allows larger amounts of data to be passed in the message. The data inside the message is also not displayed in the browser's address field.
|
| The page was last updated February 19, 2008 |