eekim.com > Talks > CGI Programming slides (1996)

Extending the Server    (01)

Your basic Web server is a glorified FTP server. All it does is retrieve files and sends them to the browser. Most people want more functionality than this, such as interactive forms and database queries.    (02)

In order to accomplish this, you have one of several options. You can rewrite the server source code and recompile. Or, you can design the server so that it is easily extensible.    (03)

The latter method is clearly preferable, and two different approaches of extending the server have emerged. One of them, which is rapidly becoming popular, is the API approach. This allows you to easily write modules that are loaded along with the rest of the server at run-time. While it allows you to create some high-performance applications, it is somewhat complex to do this.    (04)

Common Gateway Interface    (05)

The second way, of course, is CGI. As a beginning CGI programmer, you only need to know a few things. CGI is a standard way for web servers to communicate with other applications. So a CGI application is simply a program that knows how to communicate with the web server.    (06)

There are only two fundamental things that are different between a CGI and a regular application. You need to know how to receive input from the server (which gets it from the browser) and you need to know how to send output back to the server (which then sends it to the browser). Fortunately, as you will see later, both of these are relatively easy to do, and you can use almost any programming language to do this.    (07)

CGI programs use standard input and output, so there are no special programming techniques necessary to read the input and output. The CGI aspect of programming consists of parsing the input into manageable form and printing the output in a manner which web browsers will understand.    (08)

Next | Table of Contents | Previous    (09)