14.2. CGI applications and preprocessors

14.2.1. Example of a CGI application

From the discussion above, to develop a server technology is quite straightforward. All you have to do is to generate the CGI header (lines 1–5 of listing ex14-02.txt) and return a Web page. In fact, for a minimum CGI header the string

   Content-type:text/html

with a blank line at the end will be enough. Sometimes, this string is called the “magic line” of CGI applications.

Note that the standard CGI communications between client and server require the standard I/O devices. All CGI correspondence must be echoed or printed to the standard output device such as a screen or a terminal.

To output some strings to the screen is not too difficult. In fact, you can program ...

Get Practical Web Technologies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.