Home » Archimedes archive » Acorn User » AU 1997-Xmas B.adf » PD » NetPlex/!Netplex/!Help/HTML/13-cgi

NetPlex/!Netplex/!Help/HTML/13-cgi

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-Xmas B.adf » PD
Filename: NetPlex/!Netplex/!Help/HTML/13-cgi
Read OK:
File size: 45DD bytes
Load address: 0000
Exec address: 0000
File contents
<HTML>

<HEAD>
<TITLE>Netplex - CGI Programs</TITLE>
</HEAD>

<BODY TEXT="#000000" BGCOLOR="#ffffff" LINK="#004499" VLINK="#00224c" ALINK="#00cc00">

<H1><IMG SRC="images/world" ALIGN=ABSMIDDLE>  CGI Programs</H1>
<HR>

<A NAME="introduction"><H2>Introduction</H2></A>

<P>The <I>Common Gateway Interface</I> (CGI) allows you to write programs which pretend to be ordinary Web pages, but when a client requests them they are executed and the output from the program is sent instead.  By using CGI programs you can provide interactive facilities for the users accessing your server.  You may have seen access counters on WWW pages which display a small graphic showing how many times the page has been accessed - this is an example of a CGI program.</P>

<P>The CGI program is either a normal program (BASIC, Absolute, Utility) or a script (Obey, Command, Perl) kept in a special directory called <I>cgi-bin</I>.  Once invoked the program generates output that the client can use, such as an HTML page or a GIF image.  In the case of the access counter program mentioned above, the output is a GIF image.</P>

<P>CGI programs are usually referenced from a normal, static, Web pages, acting as a utility to the master page.  For example, when you fill out a form on a Web page and you click on the 'Submit' button, your browser will ask the server for a URL like this :</P>

<P><CENTER>http://bronze.netplex.net/cgi-bin/form?name=Zaphod+Beeblebrox</CENTER></P>

<P>This means that the CGI program specified by the URL "http://bronze.netplex.net/cgi-bin/form" will be invoked with the parameters "name=Zaphod+Beeblebrox".  The '?' character separates the URL of the program and the parameters to be passed to the program.  Several named parameters can be passed by separating them with the '&amp;' symbol.  For example : </P>

<P><CENTER>http://bronze.netplex.net/cgi-bin/form?firstname=Zaphod&amp;lastname=Beeblebrox</CENTER></P>

<P>Once invoked, the program will read its parameters and then generate its output which the server will send to the client.  This particular type of retrieval is known as the <I>GET method</I>.</P>

<P>The other method used is <I>POST</I>, this is different to GET in that instead of appending the parameters to the URL, it sends them as an additional 'packet' of data (officially called an 'entity') accompanying the request.  This has the advantage of allowing much larger amounts of data to be passed, since URLs are limited to a fixed number of characters.  POSTs are the preferred method of submitting form data.</P>

<P>In the case of the access counter program mentioned above, the parameters passed to it will be an ID for the user's Web page.  The counter program will look up the ID in its database, find the number of times the counter has been requested, increment it, and then generate a GIF file of the number of requests.</P>

<HR WIDTH="50%">

<A NAME="howdotheydothat"><H2>How CGI Programs Work</H2></A>

<P>HTTP - the service that Web servers provide - is a request-response mechanism.  A request is made, so the server generates a response.  When a request is made for a CGI program, the server must run it under special conditions so that it is able to send the entire output of the program to the client.</P>

<P>When a program is executing under the CGI, the usual methods of input and output - the keyboard and the screen - are redirected to a pair of disc files.  Everything that is input comes from a file on disc containing any data the client has sent to us.  Everything that is output is sent to another file on disc which gets sent to the client when the program finishes.</P>

<P>Information on the current request is passed to CGI programs by means of system variables.  There are a number of these which Netplex uses, a full list of which is included later on in this document.</P>

<P>There's not much more to it than that, at least for 'simple' CGI programs.  However, as of version 0.21, Netplex contains support allowing CGI programs to be multitasking programs.  This is more complicated as the program's input and output can no longer be completely taken over by Netplex, since other programs will be running at the same time.</P>

<P>Netplex has to provide a couple of support functions in order to allow CGI programs to multitask.  The first is a feature of the server itself, which detects a flag in a system variable indicating that a CGI program wishes to multitask.  The second is provided by the CGI support library, which allows the redirection state to be controlled.  (This is also essential if you need to run other programs from your CGI program).</P>

<P>A multitasking CGI program will initialise, inform Netplex that it wishes to multitask and then turn off its redirection.  The redirection files remain available for use, so all the program has to do in order to process is to read from and write to these files.  When the program is about to exit, it turns redirection back on so that the server can start off from where it finished.</P>

<HR WIDTH="50%">

<A NAME="writing"><H2>Writing CGI Programs</H2></A>

<P>Writing CGI programs for use with Netplex is fairly easy, as BASIC can be used to implement them quickly.  To start with an example, here's a Web-enabled Hello World program :</P>

<PRE><P>
REM >cgi-bin.helloworld  (Netplex Example 1)

PRINT "Content-Type: text/html";CHR$(13);CHR$(10);
PRINT                           CHR$(13);CHR$(10);

PRINT "&lt;HTML&gt;"
PRINT "&lt;BODY&gt;"
PRINT "&lt;H1&gt;Hello World!&lt;/H1&gt;"
PRINT "&lt;/BODY&gt;"
PRINT "&lt;/HTML&gt;"

END
</P></PRE>

<P>The first two PRINT statements are part of the header that is sent to the client.  The first line tells the client that the document is HTML text and the second, empty line, terminates the header.  Both lines are terminated by 'CHR$(13);CHR$(10);' as the usual PRINT line ending is inapropriate for header fields which must be terminated by CR,LF.  The other lines are a simple HTML 'page' which will be displayed in the browser.</P>

<P>As far as things go, this program isn't very interesting - it doesn't actually do anything <I>different</I> every time you run it, which is the point of the CGI system.  An easy modification to make it produce different output every time is to replace "Hello World!" with TIME$, which returns the current time :</P>

<PRE><P>
REM >cgi-bin.time  (Netplex Example 2)

PRINT "Content-Type: text/html";CHR$(13);CHR$(10);
PRINT                           CHR$(13);CHR$(10);

PRINT "&lt;HTML&gt;"
PRINT "&lt;BODY&gt;"
PRINT "&lt;H1&gt;"+TIME$+"&lt;/H1&gt;"
PRINT "&lt;/BODY&gt;"
PRINT "&lt;/HTML&gt;"

END
</P></PRE>

<P>Now, when the program is fetched, it will return the current time.</P>

<P>To learn more about CGI programming, you should examine the <A HREF="#examples">examples</A> given below.</P>


<H3>The CGI Library</H3>
<P>A BASIC library containing routines for use in CGI programs is provided.  Note that the library is not provided simply to make the job of programming CGI easier, it contains support code which is essential to ensure the correct operation of the server when dealing with CGI programs.  If you are thinking of programming for Netplex in other languages then you should implement an equivalent of the CGILibrary.</P>

<P>To use the CGILibrary, you should use the following instructions at the start of your program :</P>

<P><PRE>
LIBRARY "&lt;Netplex$Dir&gt;.CGILibrary"
PROCcgi_init
</P></PRE>

<P>This will set up an error handler, dimension a 256-byte block of memory called misc% and will set the variables cgi_in% and cgi_out% to the handles of the input and output data streams respectively.</P>

<P>You should call the routine PROCcgi_closedown at the end of your program.</P>

<P>The library provides the following routines :</P>
<DL>

<DT><B>PROCcgi_header(content_type$, content_length%)</B>
<DD>Given the Content-Type and Content-Length, this routine generates an appropriate response header.  Content_type$ is given as 'image/gif', 'text/html', etc.  Content_length% is the amount of data you are going to be sending, or -1 if you don't know.

<DT><B>PROCcgi_statusline(code%, phrase$)</B>
<DD>If you need to, you may generate an entire HTTP response yourself, including headers.  cgi_statusline outputs the initial HTTP status line, which informs the recipient of the version of HTTP in use, the response status code and a short phrase indicating the server's response.  You must call cgi_statusline before anything else that will cause output.

<DT><B>PROCcgi_headerline(name$, value$)</B>
<DD>This routine takes care of outputting HTTP headers with the correct line endings.  Name$ is the name of the header field and value$ is its value, so cgi_headerline("Cookie","name=cookie_monster") will generate the header line "Cookie: name=cookie_monster".  If name$ is an empty string, then cgi_headerline will output an empty line so that the header will be terminated.

<DT><B>PROCcgi_error</B>
<DD>This is automatically called when an error occurs.  It cleans up any temporary files and outputs an HTML page describing the error to the client.  The error message is also recorded in the log file.

<DT><B>FNcgi_nextelement</B>
<DD>Returns the next parameter passed to the program (POST only).

<DT><B>FNcgi_nextelementdecoded</B>
<DD>As above, but translates all of the escape codes first, by calling FNcgi_decodeelement.

<DT><B>FNcgi_decodeelement(e$)</B>
<DD>Translates all the escape characters (e.g. '%7e') in e$, and returns the translated string.

<DT><B>PROCcgi_redirect(on%)</B>
<DD>Updates the cgi_in% and cgi_out% variables.  If on% is FALSE, then redirection is turned off which is necessary with multitasking CGI programs.

<DT><B>PROCcgi_polling(on%)</B>
<DD>Sets or unsets (depending on on%) a system variable ("CGI$Active_...") which lets Netplex know that the CGI program intends to multitask.  If you intend to call Wimp_Poll in your program, you <B>must</B> call PROCcgi_polling(TRUE) before you do, and call PROCcgi_polling(FALSE) before the end of your program.</P>

<DT><B>FNmime(filetype%)</B>
<DD>Converts a filetype to a MIME Content-Type.

<DT><B>FNstring_readtoctrl(RETURN p%)</B>
<DD>Returns the string pointed to by p%, and updates p% to point to the first unread character.

<DT><B>FNcase_lower(s$)</B>
<DD>Returns the given string, in lower case.

<DT><B>FNcase_upper(s$)</B>
<DD>Returns the given string, in upper case.

<DT><B>PROCsystem_setliteral(var$, val$)</B>
<DD>Sets the system variable var$ as string val$.

<DT><B>FNsystem_getvar(var$)</B>
<DD>Returns the system variable var$ as a string.

<DT><B>FNsystem_unset(var$)</B>
<DD>Unsets the system variable var$.

</DL>


<H3>CGI System Variables</H3>

<P>Netplex passes information to CGI programs via a set of system variables, which use the prefixes 'CGI$' and 'HTTP$'.  Note that this is different to CGI on non-RISC OS servers which have different rules regarding system variables.  For example, CGI$ServerSoftware is used rather than SERVER_SOFTWARE.  This means that anyone porting CGI software or scripts from other platforms must take this into account, and adjust all references to system variables.</P>

<P>Only some of the following variables may be set, depending on the method the client used and the information it passed.</P>

<H5>Static Variables</H5>
<I>Variables which are constant for the duration of the server.</I>
<DL>
<DT>CGI$ServerSoftware
<DD>Contains the name and version of the server software, e.g. 'Netplex/0.09  (05 Oct 1996)'.
<DT>CGI$ServerName
<DD>Is the fully qualified name of the server.  At startup, Netplex will attempt to resolve this from the Inet$LocalIP variable.
<DT>CGI$GatewayInterface
<DD>Always set to "GGI/1.1".
<DT>CGI$ServerPort
<DD>Set to the port that the server is operating on.
</DL>

<H5>Dynamic Variables</H5>
<I>Variables which change according to the request.</I>
<DL>
<DT>CGI$ServerProtocol
<DD>'HTTP/1.1', 'HTTP/1.0' or 'HTTP/0.9' depending on the request received.
<DT>CGI$RequestMethod
<DD>This is set to the request method that was used to retrieve the file, e.g. GET or POST.
<DT>CGI$PathInfo
<DD>If you specify the URL http://mercury.netplex.net/cgi-bin/imagemap/dthomas then if the program imagemap exists in the cgi-bin directory, PathInfo will be set to 'dthomas'.
<DT>CGI$PathTranslated
<DD>This is the same as above but is prefixed with the path of the Web page directory.  With the above example it would be something like, 'ADFS::IDEDisc4.$.Internet.WWW.dthomas'.
<DT>CGI$ScriptFilename
<DD>The full RISC OS filename of the program.  For example 'ADFS::IDEDisc4.$.Internet.WWW.cgi-bin.process'.
<DT>CGI$ScriptName
<DD>The URL path of the program.  For example '/cgi-bin/process'.
<DT>CGI$QueryString
<DD>The data passed in the URL, which followed the '?'.  Used by GET requests to pass parameters to CGI programs.
<DT>CGI$RemoteHost
<DD>The name of the client machine, or the dotted-IP address if unknown.
<DT>CGI$RemoteAddr
<DD>The dotted-IP address of the client machine.
<DT>CGI$AuthType
<DD>If Client Authentication is in use then this will be set to 'Basic'.
<DT>CGI$AuthUser
<DD>If Client Authentication is in use then this will be set to the username of the client 'logged in'.
<DT>CGI$ContentType
<DD>The type of data that has been submitted to the program. (Applies to POST only).
<DT>CGI$ContentLength
<DD>The length of the data that that has been submitted to the program. (Applies to POST only).
<DT>CGI$ConnectionNumber
<DD>The current internal connection number that the program is operating as.  Used for ...
<DT>CGI$Active_<I>n</I>
<DD>This is set by the program to inform the server that the program is multitasking and will be making calls to Wimp_Poll.  Once unset, the server will attempt to send the program's output to the client.  (<I>n</I> is an internal connection number).
</DL>

<H5>HTTP Header Fields</H5>
<I>The header fields, as submitted by the client.</I>
<DL>
<DD>It depends entirely on the client as to what you will find set in the HTTP variables.
</DL>

<P>There is also another system variable, although not strictly linked to CGI programs, which is useful to have.  It is Netplex$WebPagesDir which gives the name of the root Web page directory.</P>


<H3>Notes</H3>
<UL>
<LI>Netplex checks the requested URL for '/cgi-bin/' and will invoke the program <B>only</B> if it is inside a 'cgi-bin' directory <B>and</B> is of type Command, Utility, BASIC, Absolute, Obey or Perl, otherwise it will be served as a file.
<LI>CGI directories do not need to be in the root Web page directory, e.g. you could have http://iron.netplex.net/users/cgi-bin/ which would still work OK.  You can have multiple cgi-bin directories if you want.
<LI>In order for CGI$PathInfo to be correct, you <B>must not</B> use subdirectories within the cgi-bin directories.
<LI>The first line of CGI output is parsed, if it begins 'HTTP/1' then it is assumed that the CGI program has generated the entire header itself and Netplex will not attach any header fields of its own.
<LI>Perl is supported, as long as it is <B>not</B> set up to run in a TaskWindow.  Perl files are detected by the file having a filetype of &amp;102.
<LI>Absolute files (filetype &amp;FF8) are checked to see if they have an APCS-like header, if they do then they are invoked using Unix-like redirection operators.
<LI>In a multitasking program, the CGI system variables are only guaranteed to be present, and valid, up until the first time you call Wimp_Poll.  This is because other multitasking programs may get started when you release control to Wimp_Poll.
</UL>

<HR WIDTH="50%">

<A NAME="examples"><H2>Examples</H2></A>

<P>These programs will not work if you're reading the help files directly.</P>

<P><DL>
<DT><B><A HREF="cgi-bin/time">Time</A></B>
<DD>A CGI program which when retrieved displays the time.
<DT><B><A HREF="cgi-bin/timeobey">TimeObey</A></B>
<DD>The same as above, but implemented as an Obey script.
<DT><B><A HREF="cgi-bin/query?This+is+the+query+example">Query</A></B>
<DD>A CGI program which when retrieved displays the query string that was passed to the program.  In this case the query string is 'This+is+the+query+example'.
<DT><B><A HREF="form">Form</A></B>
<DD>An HTML page containing a Form which when submitted is sent to a CGI program called 'form' which displays the results.  This uses the POST method rather than GET.
<DT><B><A HREF="cgi-bin/tasks">Tasks</A></B>
<DD>Dynamically builds an HTML page of information about all running tasks on your machine.
<DT><B><A HREF="cgi-bin/info">Info</A></B>
<DD>Provides information on the system variables used by Netplex to inform CGI programs of their parameters.
<DT><B><A HREF="cgi-bin/dir">Dir</A></B>
<DD>An advanced version of the Query program which uses self-references to enable the user to traverse a directory structure and serve files.  It defaults to using 'ADFS::4.$', which may not be applicable to your system.  It will only list Public-readable files.
<BR>(Note: ArcWeb fouls up with this program due to its over-zealous URL verifying).
<DT><B><A HREF="cgi-bin/velocity">Velocity</A></B>
<DD>An example of a <B>multitasking</B> CGI program.  Monitors the desktop for five seconds and then returns an figure indicating how fast the desktop is operating (in polls per second).
</DL></P>

<P><B>Note :</B> These programs are provided purely for demonstration purposes.  You should not allow open access to your machine with these programs present - particularly Dir as it allows unrestricted access to any filing system on your machine.</P>

<HR>

<P><CENTER>
<A HREF="12-auth"><IMG SRC="images/buttons/bak" WIDTH=32 HEIGHT=32 BORDER=0 ALT="[ Previous ]"></A>
<A HREF="index"><IMG SRC="images/buttons/up" WIDTH=32 HEIGHT=32 BORDER=0 ALT="[ Index ]"></A>
<A HREF="14-image"><IMG SRC="images/buttons/fwd" WIDTH=32 HEIGHT=32 BORDER=0 ALT="[ Next ]"></A>
</CENTER></P>

</BODY>

</HTML>
00000000  3c 48 54 4d 4c 3e 0a 0a  3c 48 45 41 44 3e 0a 3c  |<HTML>..<HEAD>.<|
00000010  54 49 54 4c 45 3e 4e 65  74 70 6c 65 78 20 2d 20  |TITLE>Netplex - |
00000020  43 47 49 20 50 72 6f 67  72 61 6d 73 3c 2f 54 49  |CGI Programs</TI|
00000030  54 4c 45 3e 0a 3c 2f 48  45 41 44 3e 0a 0a 3c 42  |TLE>.</HEAD>..<B|
00000040  4f 44 59 20 54 45 58 54  3d 22 23 30 30 30 30 30  |ODY TEXT="#00000|
00000050  30 22 20 42 47 43 4f 4c  4f 52 3d 22 23 66 66 66  |0" BGCOLOR="#fff|
00000060  66 66 66 22 20 4c 49 4e  4b 3d 22 23 30 30 34 34  |fff" LINK="#0044|
00000070  39 39 22 20 56 4c 49 4e  4b 3d 22 23 30 30 32 32  |99" VLINK="#0022|
00000080  34 63 22 20 41 4c 49 4e  4b 3d 22 23 30 30 63 63  |4c" ALINK="#00cc|
00000090  30 30 22 3e 0a 0a 3c 48  31 3e 3c 49 4d 47 20 53  |00">..<H1><IMG S|
000000a0  52 43 3d 22 69 6d 61 67  65 73 2f 77 6f 72 6c 64  |RC="images/world|
000000b0  22 20 41 4c 49 47 4e 3d  41 42 53 4d 49 44 44 4c  |" ALIGN=ABSMIDDL|
000000c0  45 3e 20 20 43 47 49 20  50 72 6f 67 72 61 6d 73  |E>  CGI Programs|
000000d0  3c 2f 48 31 3e 0a 3c 48  52 3e 0a 0a 3c 41 20 4e  |</H1>.<HR>..<A N|
000000e0  41 4d 45 3d 22 69 6e 74  72 6f 64 75 63 74 69 6f  |AME="introductio|
000000f0  6e 22 3e 3c 48 32 3e 49  6e 74 72 6f 64 75 63 74  |n"><H2>Introduct|
00000100  69 6f 6e 3c 2f 48 32 3e  3c 2f 41 3e 0a 0a 3c 50  |ion</H2></A>..<P|
00000110  3e 54 68 65 20 3c 49 3e  43 6f 6d 6d 6f 6e 20 47  |>The <I>Common G|
00000120  61 74 65 77 61 79 20 49  6e 74 65 72 66 61 63 65  |ateway Interface|
00000130  3c 2f 49 3e 20 28 43 47  49 29 20 61 6c 6c 6f 77  |</I> (CGI) allow|
00000140  73 20 79 6f 75 20 74 6f  20 77 72 69 74 65 20 70  |s you to write p|
00000150  72 6f 67 72 61 6d 73 20  77 68 69 63 68 20 70 72  |rograms which pr|
00000160  65 74 65 6e 64 20 74 6f  20 62 65 20 6f 72 64 69  |etend to be ordi|
00000170  6e 61 72 79 20 57 65 62  20 70 61 67 65 73 2c 20  |nary Web pages, |
00000180  62 75 74 20 77 68 65 6e  20 61 20 63 6c 69 65 6e  |but when a clien|
00000190  74 20 72 65 71 75 65 73  74 73 20 74 68 65 6d 20  |t requests them |
000001a0  74 68 65 79 20 61 72 65  20 65 78 65 63 75 74 65  |they are execute|
000001b0  64 20 61 6e 64 20 74 68  65 20 6f 75 74 70 75 74  |d and the output|
000001c0  20 66 72 6f 6d 20 74 68  65 20 70 72 6f 67 72 61  | from the progra|
000001d0  6d 20 69 73 20 73 65 6e  74 20 69 6e 73 74 65 61  |m is sent instea|
000001e0  64 2e 20 20 42 79 20 75  73 69 6e 67 20 43 47 49  |d.  By using CGI|
000001f0  20 70 72 6f 67 72 61 6d  73 20 79 6f 75 20 63 61  | programs you ca|
00000200  6e 20 70 72 6f 76 69 64  65 20 69 6e 74 65 72 61  |n provide intera|
00000210  63 74 69 76 65 20 66 61  63 69 6c 69 74 69 65 73  |ctive facilities|
00000220  20 66 6f 72 20 74 68 65  20 75 73 65 72 73 20 61  | for the users a|
00000230  63 63 65 73 73 69 6e 67  20 79 6f 75 72 20 73 65  |ccessing your se|
00000240  72 76 65 72 2e 20 20 59  6f 75 20 6d 61 79 20 68  |rver.  You may h|
00000250  61 76 65 20 73 65 65 6e  20 61 63 63 65 73 73 20  |ave seen access |
00000260  63 6f 75 6e 74 65 72 73  20 6f 6e 20 57 57 57 20  |counters on WWW |
00000270  70 61 67 65 73 20 77 68  69 63 68 20 64 69 73 70  |pages which disp|
00000280  6c 61 79 20 61 20 73 6d  61 6c 6c 20 67 72 61 70  |lay a small grap|
00000290  68 69 63 20 73 68 6f 77  69 6e 67 20 68 6f 77 20  |hic showing how |
000002a0  6d 61 6e 79 20 74 69 6d  65 73 20 74 68 65 20 70  |many times the p|
000002b0  61 67 65 20 68 61 73 20  62 65 65 6e 20 61 63 63  |age has been acc|
000002c0  65 73 73 65 64 20 2d 20  74 68 69 73 20 69 73 20  |essed - this is |
000002d0  61 6e 20 65 78 61 6d 70  6c 65 20 6f 66 20 61 20  |an example of a |
000002e0  43 47 49 20 70 72 6f 67  72 61 6d 2e 3c 2f 50 3e  |CGI program.</P>|
000002f0  0a 0a 3c 50 3e 54 68 65  20 43 47 49 20 70 72 6f  |..<P>The CGI pro|
00000300  67 72 61 6d 20 69 73 20  65 69 74 68 65 72 20 61  |gram is either a|
00000310  20 6e 6f 72 6d 61 6c 20  70 72 6f 67 72 61 6d 20  | normal program |
00000320  28 42 41 53 49 43 2c 20  41 62 73 6f 6c 75 74 65  |(BASIC, Absolute|
00000330  2c 20 55 74 69 6c 69 74  79 29 20 6f 72 20 61 20  |, Utility) or a |
00000340  73 63 72 69 70 74 20 28  4f 62 65 79 2c 20 43 6f  |script (Obey, Co|
00000350  6d 6d 61 6e 64 2c 20 50  65 72 6c 29 20 6b 65 70  |mmand, Perl) kep|
00000360  74 20 69 6e 20 61 20 73  70 65 63 69 61 6c 20 64  |t in a special d|
00000370  69 72 65 63 74 6f 72 79  20 63 61 6c 6c 65 64 20  |irectory called |
00000380  3c 49 3e 63 67 69 2d 62  69 6e 3c 2f 49 3e 2e 20  |<I>cgi-bin</I>. |
00000390  20 4f 6e 63 65 20 69 6e  76 6f 6b 65 64 20 74 68  | Once invoked th|
000003a0  65 20 70 72 6f 67 72 61  6d 20 67 65 6e 65 72 61  |e program genera|
000003b0  74 65 73 20 6f 75 74 70  75 74 20 74 68 61 74 20  |tes output that |
000003c0  74 68 65 20 63 6c 69 65  6e 74 20 63 61 6e 20 75  |the client can u|
000003d0  73 65 2c 20 73 75 63 68  20 61 73 20 61 6e 20 48  |se, such as an H|
000003e0  54 4d 4c 20 70 61 67 65  20 6f 72 20 61 20 47 49  |TML page or a GI|
000003f0  46 20 69 6d 61 67 65 2e  20 20 49 6e 20 74 68 65  |F image.  In the|
00000400  20 63 61 73 65 20 6f 66  20 74 68 65 20 61 63 63  | case of the acc|
00000410  65 73 73 20 63 6f 75 6e  74 65 72 20 70 72 6f 67  |ess counter prog|
00000420  72 61 6d 20 6d 65 6e 74  69 6f 6e 65 64 20 61 62  |ram mentioned ab|
00000430  6f 76 65 2c 20 74 68 65  20 6f 75 74 70 75 74 20  |ove, the output |
00000440  69 73 20 61 20 47 49 46  20 69 6d 61 67 65 2e 3c  |is a GIF image.<|
00000450  2f 50 3e 0a 0a 3c 50 3e  43 47 49 20 70 72 6f 67  |/P>..<P>CGI prog|
00000460  72 61 6d 73 20 61 72 65  20 75 73 75 61 6c 6c 79  |rams are usually|
00000470  20 72 65 66 65 72 65 6e  63 65 64 20 66 72 6f 6d  | referenced from|
00000480  20 61 20 6e 6f 72 6d 61  6c 2c 20 73 74 61 74 69  | a normal, stati|
00000490  63 2c 20 57 65 62 20 70  61 67 65 73 2c 20 61 63  |c, Web pages, ac|
000004a0  74 69 6e 67 20 61 73 20  61 20 75 74 69 6c 69 74  |ting as a utilit|
000004b0  79 20 74 6f 20 74 68 65  20 6d 61 73 74 65 72 20  |y to the master |
000004c0  70 61 67 65 2e 20 20 46  6f 72 20 65 78 61 6d 70  |page.  For examp|
000004d0  6c 65 2c 20 77 68 65 6e  20 79 6f 75 20 66 69 6c  |le, when you fil|
000004e0  6c 20 6f 75 74 20 61 20  66 6f 72 6d 20 6f 6e 20  |l out a form on |
000004f0  61 20 57 65 62 20 70 61  67 65 20 61 6e 64 20 79  |a Web page and y|
00000500  6f 75 20 63 6c 69 63 6b  20 6f 6e 20 74 68 65 20  |ou click on the |
00000510  27 53 75 62 6d 69 74 27  20 62 75 74 74 6f 6e 2c  |'Submit' button,|
00000520  20 79 6f 75 72 20 62 72  6f 77 73 65 72 20 77 69  | your browser wi|
00000530  6c 6c 20 61 73 6b 20 74  68 65 20 73 65 72 76 65  |ll ask the serve|
00000540  72 20 66 6f 72 20 61 20  55 52 4c 20 6c 69 6b 65  |r for a URL like|
00000550  20 74 68 69 73 20 3a 3c  2f 50 3e 0a 0a 3c 50 3e  | this :</P>..<P>|
00000560  3c 43 45 4e 54 45 52 3e  68 74 74 70 3a 2f 2f 62  |<CENTER>http://b|
00000570  72 6f 6e 7a 65 2e 6e 65  74 70 6c 65 78 2e 6e 65  |ronze.netplex.ne|
00000580  74 2f 63 67 69 2d 62 69  6e 2f 66 6f 72 6d 3f 6e  |t/cgi-bin/form?n|
00000590  61 6d 65 3d 5a 61 70 68  6f 64 2b 42 65 65 62 6c  |ame=Zaphod+Beebl|
000005a0  65 62 72 6f 78 3c 2f 43  45 4e 54 45 52 3e 3c 2f  |ebrox</CENTER></|
000005b0  50 3e 0a 0a 3c 50 3e 54  68 69 73 20 6d 65 61 6e  |P>..<P>This mean|
000005c0  73 20 74 68 61 74 20 74  68 65 20 43 47 49 20 70  |s that the CGI p|
000005d0  72 6f 67 72 61 6d 20 73  70 65 63 69 66 69 65 64  |rogram specified|
000005e0  20 62 79 20 74 68 65 20  55 52 4c 20 22 68 74 74  | by the URL "htt|
000005f0  70 3a 2f 2f 62 72 6f 6e  7a 65 2e 6e 65 74 70 6c  |p://bronze.netpl|
00000600  65 78 2e 6e 65 74 2f 63  67 69 2d 62 69 6e 2f 66  |ex.net/cgi-bin/f|
00000610  6f 72 6d 22 20 77 69 6c  6c 20 62 65 20 69 6e 76  |orm" will be inv|
00000620  6f 6b 65 64 20 77 69 74  68 20 74 68 65 20 70 61  |oked with the pa|
00000630  72 61 6d 65 74 65 72 73  20 22 6e 61 6d 65 3d 5a  |rameters "name=Z|
00000640  61 70 68 6f 64 2b 42 65  65 62 6c 65 62 72 6f 78  |aphod+Beeblebrox|
00000650  22 2e 20 20 54 68 65 20  27 3f 27 20 63 68 61 72  |".  The '?' char|
00000660  61 63 74 65 72 20 73 65  70 61 72 61 74 65 73 20  |acter separates |
00000670  74 68 65 20 55 52 4c 20  6f 66 20 74 68 65 20 70  |the URL of the p|
00000680  72 6f 67 72 61 6d 20 61  6e 64 20 74 68 65 20 70  |rogram and the p|
00000690  61 72 61 6d 65 74 65 72  73 20 74 6f 20 62 65 20  |arameters to be |
000006a0  70 61 73 73 65 64 20 74  6f 20 74 68 65 20 70 72  |passed to the pr|
000006b0  6f 67 72 61 6d 2e 20 20  53 65 76 65 72 61 6c 20  |ogram.  Several |
000006c0  6e 61 6d 65 64 20 70 61  72 61 6d 65 74 65 72 73  |named parameters|
000006d0  20 63 61 6e 20 62 65 20  70 61 73 73 65 64 20 62  | can be passed b|
000006e0  79 20 73 65 70 61 72 61  74 69 6e 67 20 74 68 65  |y separating the|
000006f0  6d 20 77 69 74 68 20 74  68 65 20 27 26 61 6d 70  |m with the '&amp|
00000700  3b 27 20 73 79 6d 62 6f  6c 2e 20 20 46 6f 72 20  |;' symbol.  For |
00000710  65 78 61 6d 70 6c 65 20  3a 20 3c 2f 50 3e 0a 0a  |example : </P>..|
00000720  3c 50 3e 3c 43 45 4e 54  45 52 3e 68 74 74 70 3a  |<P><CENTER>http:|
00000730  2f 2f 62 72 6f 6e 7a 65  2e 6e 65 74 70 6c 65 78  |//bronze.netplex|
00000740  2e 6e 65 74 2f 63 67 69  2d 62 69 6e 2f 66 6f 72  |.net/cgi-bin/for|
00000750  6d 3f 66 69 72 73 74 6e  61 6d 65 3d 5a 61 70 68  |m?firstname=Zaph|
00000760  6f 64 26 61 6d 70 3b 6c  61 73 74 6e 61 6d 65 3d  |od&amp;lastname=|
00000770  42 65 65 62 6c 65 62 72  6f 78 3c 2f 43 45 4e 54  |Beeblebrox</CENT|
00000780  45 52 3e 3c 2f 50 3e 0a  0a 3c 50 3e 4f 6e 63 65  |ER></P>..<P>Once|
00000790  20 69 6e 76 6f 6b 65 64  2c 20 74 68 65 20 70 72  | invoked, the pr|
000007a0  6f 67 72 61 6d 20 77 69  6c 6c 20 72 65 61 64 20  |ogram will read |
000007b0  69 74 73 20 70 61 72 61  6d 65 74 65 72 73 20 61  |its parameters a|
000007c0  6e 64 20 74 68 65 6e 20  67 65 6e 65 72 61 74 65  |nd then generate|
000007d0  20 69 74 73 20 6f 75 74  70 75 74 20 77 68 69 63  | its output whic|
000007e0  68 20 74 68 65 20 73 65  72 76 65 72 20 77 69 6c  |h the server wil|
000007f0  6c 20 73 65 6e 64 20 74  6f 20 74 68 65 20 63 6c  |l send to the cl|
00000800  69 65 6e 74 2e 20 20 54  68 69 73 20 70 61 72 74  |ient.  This part|
00000810  69 63 75 6c 61 72 20 74  79 70 65 20 6f 66 20 72  |icular type of r|
00000820  65 74 72 69 65 76 61 6c  20 69 73 20 6b 6e 6f 77  |etrieval is know|
00000830  6e 20 61 73 20 74 68 65  20 3c 49 3e 47 45 54 20  |n as the <I>GET |
00000840  6d 65 74 68 6f 64 3c 2f  49 3e 2e 3c 2f 50 3e 0a  |method</I>.</P>.|
00000850  0a 3c 50 3e 54 68 65 20  6f 74 68 65 72 20 6d 65  |.<P>The other me|
00000860  74 68 6f 64 20 75 73 65  64 20 69 73 20 3c 49 3e  |thod used is <I>|
00000870  50 4f 53 54 3c 2f 49 3e  2c 20 74 68 69 73 20 69  |POST</I>, this i|
00000880  73 20 64 69 66 66 65 72  65 6e 74 20 74 6f 20 47  |s different to G|
00000890  45 54 20 69 6e 20 74 68  61 74 20 69 6e 73 74 65  |ET in that inste|
000008a0  61 64 20 6f 66 20 61 70  70 65 6e 64 69 6e 67 20  |ad of appending |
000008b0  74 68 65 20 70 61 72 61  6d 65 74 65 72 73 20 74  |the parameters t|
000008c0  6f 20 74 68 65 20 55 52  4c 2c 20 69 74 20 73 65  |o the URL, it se|
000008d0  6e 64 73 20 74 68 65 6d  20 61 73 20 61 6e 20 61  |nds them as an a|
000008e0  64 64 69 74 69 6f 6e 61  6c 20 27 70 61 63 6b 65  |dditional 'packe|
000008f0  74 27 20 6f 66 20 64 61  74 61 20 28 6f 66 66 69  |t' of data (offi|
00000900  63 69 61 6c 6c 79 20 63  61 6c 6c 65 64 20 61 6e  |cially called an|
00000910  20 27 65 6e 74 69 74 79  27 29 20 61 63 63 6f 6d  | 'entity') accom|
00000920  70 61 6e 79 69 6e 67 20  74 68 65 20 72 65 71 75  |panying the requ|
00000930  65 73 74 2e 20 20 54 68  69 73 20 68 61 73 20 74  |est.  This has t|
00000940  68 65 20 61 64 76 61 6e  74 61 67 65 20 6f 66 20  |he advantage of |
00000950  61 6c 6c 6f 77 69 6e 67  20 6d 75 63 68 20 6c 61  |allowing much la|
00000960  72 67 65 72 20 61 6d 6f  75 6e 74 73 20 6f 66 20  |rger amounts of |
00000970  64 61 74 61 20 74 6f 20  62 65 20 70 61 73 73 65  |data to be passe|
00000980  64 2c 20 73 69 6e 63 65  20 55 52 4c 73 20 61 72  |d, since URLs ar|
00000990  65 20 6c 69 6d 69 74 65  64 20 74 6f 20 61 20 66  |e limited to a f|
000009a0  69 78 65 64 20 6e 75 6d  62 65 72 20 6f 66 20 63  |ixed number of c|
000009b0  68 61 72 61 63 74 65 72  73 2e 20 20 50 4f 53 54  |haracters.  POST|
000009c0  73 20 61 72 65 20 74 68  65 20 70 72 65 66 65 72  |s are the prefer|
000009d0  72 65 64 20 6d 65 74 68  6f 64 20 6f 66 20 73 75  |red method of su|
000009e0  62 6d 69 74 74 69 6e 67  20 66 6f 72 6d 20 64 61  |bmitting form da|
000009f0  74 61 2e 3c 2f 50 3e 0a  0a 3c 50 3e 49 6e 20 74  |ta.</P>..<P>In t|
00000a00  68 65 20 63 61 73 65 20  6f 66 20 74 68 65 20 61  |he case of the a|
00000a10  63 63 65 73 73 20 63 6f  75 6e 74 65 72 20 70 72  |ccess counter pr|
00000a20  6f 67 72 61 6d 20 6d 65  6e 74 69 6f 6e 65 64 20  |ogram mentioned |
00000a30  61 62 6f 76 65 2c 20 74  68 65 20 70 61 72 61 6d  |above, the param|
00000a40  65 74 65 72 73 20 70 61  73 73 65 64 20 74 6f 20  |eters passed to |
00000a50  69 74 20 77 69 6c 6c 20  62 65 20 61 6e 20 49 44  |it will be an ID|
00000a60  20 66 6f 72 20 74 68 65  20 75 73 65 72 27 73 20  | for the user's |
00000a70  57 65 62 20 70 61 67 65  2e 20 20 54 68 65 20 63  |Web page.  The c|
00000a80  6f 75 6e 74 65 72 20 70  72 6f 67 72 61 6d 20 77  |ounter program w|
00000a90  69 6c 6c 20 6c 6f 6f 6b  20 75 70 20 74 68 65 20  |ill look up the |
00000aa0  49 44 20 69 6e 20 69 74  73 20 64 61 74 61 62 61  |ID in its databa|
00000ab0  73 65 2c 20 66 69 6e 64  20 74 68 65 20 6e 75 6d  |se, find the num|
00000ac0  62 65 72 20 6f 66 20 74  69 6d 65 73 20 74 68 65  |ber of times the|
00000ad0  20 63 6f 75 6e 74 65 72  20 68 61 73 20 62 65 65  | counter has bee|
00000ae0  6e 20 72 65 71 75 65 73  74 65 64 2c 20 69 6e 63  |n requested, inc|
00000af0  72 65 6d 65 6e 74 20 69  74 2c 20 61 6e 64 20 74  |rement it, and t|
00000b00  68 65 6e 20 67 65 6e 65  72 61 74 65 20 61 20 47  |hen generate a G|
00000b10  49 46 20 66 69 6c 65 20  6f 66 20 74 68 65 20 6e  |IF file of the n|
00000b20  75 6d 62 65 72 20 6f 66  20 72 65 71 75 65 73 74  |umber of request|
00000b30  73 2e 3c 2f 50 3e 0a 0a  3c 48 52 20 57 49 44 54  |s.</P>..<HR WIDT|
00000b40  48 3d 22 35 30 25 22 3e  0a 0a 3c 41 20 4e 41 4d  |H="50%">..<A NAM|
00000b50  45 3d 22 68 6f 77 64 6f  74 68 65 79 64 6f 74 68  |E="howdotheydoth|
00000b60  61 74 22 3e 3c 48 32 3e  48 6f 77 20 43 47 49 20  |at"><H2>How CGI |
00000b70  50 72 6f 67 72 61 6d 73  20 57 6f 72 6b 3c 2f 48  |Programs Work</H|
00000b80  32 3e 3c 2f 41 3e 0a 0a  3c 50 3e 48 54 54 50 20  |2></A>..<P>HTTP |
00000b90  2d 20 74 68 65 20 73 65  72 76 69 63 65 20 74 68  |- the service th|
00000ba0  61 74 20 57 65 62 20 73  65 72 76 65 72 73 20 70  |at Web servers p|
00000bb0  72 6f 76 69 64 65 20 2d  20 69 73 20 61 20 72 65  |rovide - is a re|
00000bc0  71 75 65 73 74 2d 72 65  73 70 6f 6e 73 65 20 6d  |quest-response m|
00000bd0  65 63 68 61 6e 69 73 6d  2e 20 20 41 20 72 65 71  |echanism.  A req|
00000be0  75 65 73 74 20 69 73 20  6d 61 64 65 2c 20 73 6f  |uest is made, so|
00000bf0  20 74 68 65 20 73 65 72  76 65 72 20 67 65 6e 65  | the server gene|
00000c00  72 61 74 65 73 20 61 20  72 65 73 70 6f 6e 73 65  |rates a response|
00000c10  2e 20 20 57 68 65 6e 20  61 20 72 65 71 75 65 73  |.  When a reques|
00000c20  74 20 69 73 20 6d 61 64  65 20 66 6f 72 20 61 20  |t is made for a |
00000c30  43 47 49 20 70 72 6f 67  72 61 6d 2c 20 74 68 65  |CGI program, the|
00000c40  20 73 65 72 76 65 72 20  6d 75 73 74 20 72 75 6e  | server must run|
00000c50  20 69 74 20 75 6e 64 65  72 20 73 70 65 63 69 61  | it under specia|
00000c60  6c 20 63 6f 6e 64 69 74  69 6f 6e 73 20 73 6f 20  |l conditions so |
00000c70  74 68 61 74 20 69 74 20  69 73 20 61 62 6c 65 20  |that it is able |
00000c80  74 6f 20 73 65 6e 64 20  74 68 65 20 65 6e 74 69  |to send the enti|
00000c90  72 65 20 6f 75 74 70 75  74 20 6f 66 20 74 68 65  |re output of the|
00000ca0  20 70 72 6f 67 72 61 6d  20 74 6f 20 74 68 65 20  | program to the |
00000cb0  63 6c 69 65 6e 74 2e 3c  2f 50 3e 0a 0a 3c 50 3e  |client.</P>..<P>|
00000cc0  57 68 65 6e 20 61 20 70  72 6f 67 72 61 6d 20 69  |When a program i|
00000cd0  73 20 65 78 65 63 75 74  69 6e 67 20 75 6e 64 65  |s executing unde|
00000ce0  72 20 74 68 65 20 43 47  49 2c 20 74 68 65 20 75  |r the CGI, the u|
00000cf0  73 75 61 6c 20 6d 65 74  68 6f 64 73 20 6f 66 20  |sual methods of |
00000d00  69 6e 70 75 74 20 61 6e  64 20 6f 75 74 70 75 74  |input and output|
00000d10  20 2d 20 74 68 65 20 6b  65 79 62 6f 61 72 64 20  | - the keyboard |
00000d20  61 6e 64 20 74 68 65 20  73 63 72 65 65 6e 20 2d  |and the screen -|
00000d30  20 61 72 65 20 72 65 64  69 72 65 63 74 65 64 20  | are redirected |
00000d40  74 6f 20 61 20 70 61 69  72 20 6f 66 20 64 69 73  |to a pair of dis|
00000d50  63 20 66 69 6c 65 73 2e  20 20 45 76 65 72 79 74  |c files.  Everyt|
00000d60  68 69 6e 67 20 74 68 61  74 20 69 73 20 69 6e 70  |hing that is inp|
00000d70  75 74 20 63 6f 6d 65 73  20 66 72 6f 6d 20 61 20  |ut comes from a |
00000d80  66 69 6c 65 20 6f 6e 20  64 69 73 63 20 63 6f 6e  |file on disc con|
00000d90  74 61 69 6e 69 6e 67 20  61 6e 79 20 64 61 74 61  |taining any data|
00000da0  20 74 68 65 20 63 6c 69  65 6e 74 20 68 61 73 20  | the client has |
00000db0  73 65 6e 74 20 74 6f 20  75 73 2e 20 20 45 76 65  |sent to us.  Eve|
00000dc0  72 79 74 68 69 6e 67 20  74 68 61 74 20 69 73 20  |rything that is |
00000dd0  6f 75 74 70 75 74 20 69  73 20 73 65 6e 74 20 74  |output is sent t|
00000de0  6f 20 61 6e 6f 74 68 65  72 20 66 69 6c 65 20 6f  |o another file o|
00000df0  6e 20 64 69 73 63 20 77  68 69 63 68 20 67 65 74  |n disc which get|
00000e00  73 20 73 65 6e 74 20 74  6f 20 74 68 65 20 63 6c  |s sent to the cl|
00000e10  69 65 6e 74 20 77 68 65  6e 20 74 68 65 20 70 72  |ient when the pr|
00000e20  6f 67 72 61 6d 20 66 69  6e 69 73 68 65 73 2e 3c  |ogram finishes.<|
00000e30  2f 50 3e 0a 0a 3c 50 3e  49 6e 66 6f 72 6d 61 74  |/P>..<P>Informat|
00000e40  69 6f 6e 20 6f 6e 20 74  68 65 20 63 75 72 72 65  |ion on the curre|
00000e50  6e 74 20 72 65 71 75 65  73 74 20 69 73 20 70 61  |nt request is pa|
00000e60  73 73 65 64 20 74 6f 20  43 47 49 20 70 72 6f 67  |ssed to CGI prog|
00000e70  72 61 6d 73 20 62 79 20  6d 65 61 6e 73 20 6f 66  |rams by means of|
00000e80  20 73 79 73 74 65 6d 20  76 61 72 69 61 62 6c 65  | system variable|
00000e90  73 2e 20 20 54 68 65 72  65 20 61 72 65 20 61 20  |s.  There are a |
00000ea0  6e 75 6d 62 65 72 20 6f  66 20 74 68 65 73 65 20  |number of these |
00000eb0  77 68 69 63 68 20 4e 65  74 70 6c 65 78 20 75 73  |which Netplex us|
00000ec0  65 73 2c 20 61 20 66 75  6c 6c 20 6c 69 73 74 20  |es, a full list |
00000ed0  6f 66 20 77 68 69 63 68  20 69 73 20 69 6e 63 6c  |of which is incl|
00000ee0  75 64 65 64 20 6c 61 74  65 72 20 6f 6e 20 69 6e  |uded later on in|
00000ef0  20 74 68 69 73 20 64 6f  63 75 6d 65 6e 74 2e 3c  | this document.<|
00000f00  2f 50 3e 0a 0a 3c 50 3e  54 68 65 72 65 27 73 20  |/P>..<P>There's |
00000f10  6e 6f 74 20 6d 75 63 68  20 6d 6f 72 65 20 74 6f  |not much more to|
00000f20  20 69 74 20 74 68 61 6e  20 74 68 61 74 2c 20 61  | it than that, a|
00000f30  74 20 6c 65 61 73 74 20  66 6f 72 20 27 73 69 6d  |t least for 'sim|
00000f40  70 6c 65 27 20 43 47 49  20 70 72 6f 67 72 61 6d  |ple' CGI program|
00000f50  73 2e 20 20 48 6f 77 65  76 65 72 2c 20 61 73 20  |s.  However, as |
00000f60  6f 66 20 76 65 72 73 69  6f 6e 20 30 2e 32 31 2c  |of version 0.21,|
00000f70  20 4e 65 74 70 6c 65 78  20 63 6f 6e 74 61 69 6e  | Netplex contain|
00000f80  73 20 73 75 70 70 6f 72  74 20 61 6c 6c 6f 77 69  |s support allowi|
00000f90  6e 67 20 43 47 49 20 70  72 6f 67 72 61 6d 73 20  |ng CGI programs |
00000fa0  74 6f 20 62 65 20 6d 75  6c 74 69 74 61 73 6b 69  |to be multitaski|
00000fb0  6e 67 20 70 72 6f 67 72  61 6d 73 2e 20 20 54 68  |ng programs.  Th|
00000fc0  69 73 20 69 73 20 6d 6f  72 65 20 63 6f 6d 70 6c  |is is more compl|
00000fd0  69 63 61 74 65 64 20 61  73 20 74 68 65 20 70 72  |icated as the pr|
00000fe0  6f 67 72 61 6d 27 73 20  69 6e 70 75 74 20 61 6e  |ogram's input an|
00000ff0  64 20 6f 75 74 70 75 74  20 63 61 6e 20 6e 6f 20  |d output can no |
00001000  6c 6f 6e 67 65 72 20 62  65 20 63 6f 6d 70 6c 65  |longer be comple|
00001010  74 65 6c 79 20 74 61 6b  65 6e 20 6f 76 65 72 20  |tely taken over |
00001020  62 79 20 4e 65 74 70 6c  65 78 2c 20 73 69 6e 63  |by Netplex, sinc|
00001030  65 20 6f 74 68 65 72 20  70 72 6f 67 72 61 6d 73  |e other programs|
00001040  20 77 69 6c 6c 20 62 65  20 72 75 6e 6e 69 6e 67  | will be running|
00001050  20 61 74 20 74 68 65 20  73 61 6d 65 20 74 69 6d  | at the same tim|
00001060  65 2e 3c 2f 50 3e 0a 0a  3c 50 3e 4e 65 74 70 6c  |e.</P>..<P>Netpl|
00001070  65 78 20 68 61 73 20 74  6f 20 70 72 6f 76 69 64  |ex has to provid|
00001080  65 20 61 20 63 6f 75 70  6c 65 20 6f 66 20 73 75  |e a couple of su|
00001090  70 70 6f 72 74 20 66 75  6e 63 74 69 6f 6e 73 20  |pport functions |
000010a0  69 6e 20 6f 72 64 65 72  20 74 6f 20 61 6c 6c 6f  |in order to allo|
000010b0  77 20 43 47 49 20 70 72  6f 67 72 61 6d 73 20 74  |w CGI programs t|
000010c0  6f 20 6d 75 6c 74 69 74  61 73 6b 2e 20 20 54 68  |o multitask.  Th|
000010d0  65 20 66 69 72 73 74 20  69 73 20 61 20 66 65 61  |e first is a fea|
000010e0  74 75 72 65 20 6f 66 20  74 68 65 20 73 65 72 76  |ture of the serv|
000010f0  65 72 20 69 74 73 65 6c  66 2c 20 77 68 69 63 68  |er itself, which|
00001100  20 64 65 74 65 63 74 73  20 61 20 66 6c 61 67 20  | detects a flag |
00001110  69 6e 20 61 20 73 79 73  74 65 6d 20 76 61 72 69  |in a system vari|
00001120  61 62 6c 65 20 69 6e 64  69 63 61 74 69 6e 67 20  |able indicating |
00001130  74 68 61 74 20 61 20 43  47 49 20 70 72 6f 67 72  |that a CGI progr|
00001140  61 6d 20 77 69 73 68 65  73 20 74 6f 20 6d 75 6c  |am wishes to mul|
00001150  74 69 74 61 73 6b 2e 20  20 54 68 65 20 73 65 63  |titask.  The sec|
00001160  6f 6e 64 20 69 73 20 70  72 6f 76 69 64 65 64 20  |ond is provided |
00001170  62 79 20 74 68 65 20 43  47 49 20 73 75 70 70 6f  |by the CGI suppo|
00001180  72 74 20 6c 69 62 72 61  72 79 2c 20 77 68 69 63  |rt library, whic|
00001190  68 20 61 6c 6c 6f 77 73  20 74 68 65 20 72 65 64  |h allows the red|
000011a0  69 72 65 63 74 69 6f 6e  20 73 74 61 74 65 20 74  |irection state t|
000011b0  6f 20 62 65 20 63 6f 6e  74 72 6f 6c 6c 65 64 2e  |o be controlled.|
000011c0  20 20 28 54 68 69 73 20  69 73 20 61 6c 73 6f 20  |  (This is also |
000011d0  65 73 73 65 6e 74 69 61  6c 20 69 66 20 79 6f 75  |essential if you|
000011e0  20 6e 65 65 64 20 74 6f  20 72 75 6e 20 6f 74 68  | need to run oth|
000011f0  65 72 20 70 72 6f 67 72  61 6d 73 20 66 72 6f 6d  |er programs from|
00001200  20 79 6f 75 72 20 43 47  49 20 70 72 6f 67 72 61  | your CGI progra|
00001210  6d 29 2e 3c 2f 50 3e 0a  0a 3c 50 3e 41 20 6d 75  |m).</P>..<P>A mu|
00001220  6c 74 69 74 61 73 6b 69  6e 67 20 43 47 49 20 70  |ltitasking CGI p|
00001230  72 6f 67 72 61 6d 20 77  69 6c 6c 20 69 6e 69 74  |rogram will init|
00001240  69 61 6c 69 73 65 2c 20  69 6e 66 6f 72 6d 20 4e  |ialise, inform N|
00001250  65 74 70 6c 65 78 20 74  68 61 74 20 69 74 20 77  |etplex that it w|
00001260  69 73 68 65 73 20 74 6f  20 6d 75 6c 74 69 74 61  |ishes to multita|
00001270  73 6b 20 61 6e 64 20 74  68 65 6e 20 74 75 72 6e  |sk and then turn|
00001280  20 6f 66 66 20 69 74 73  20 72 65 64 69 72 65 63  | off its redirec|
00001290  74 69 6f 6e 2e 20 20 54  68 65 20 72 65 64 69 72  |tion.  The redir|
000012a0  65 63 74 69 6f 6e 20 66  69 6c 65 73 20 72 65 6d  |ection files rem|
000012b0  61 69 6e 20 61 76 61 69  6c 61 62 6c 65 20 66 6f  |ain available fo|
000012c0  72 20 75 73 65 2c 20 73  6f 20 61 6c 6c 20 74 68  |r use, so all th|
000012d0  65 20 70 72 6f 67 72 61  6d 20 68 61 73 20 74 6f  |e program has to|
000012e0  20 64 6f 20 69 6e 20 6f  72 64 65 72 20 74 6f 20  | do in order to |
000012f0  70 72 6f 63 65 73 73 20  69 73 20 74 6f 20 72 65  |process is to re|
00001300  61 64 20 66 72 6f 6d 20  61 6e 64 20 77 72 69 74  |ad from and writ|
00001310  65 20 74 6f 20 74 68 65  73 65 20 66 69 6c 65 73  |e to these files|
00001320  2e 20 20 57 68 65 6e 20  74 68 65 20 70 72 6f 67  |.  When the prog|
00001330  72 61 6d 20 69 73 20 61  62 6f 75 74 20 74 6f 20  |ram is about to |
00001340  65 78 69 74 2c 20 69 74  20 74 75 72 6e 73 20 72  |exit, it turns r|
00001350  65 64 69 72 65 63 74 69  6f 6e 20 62 61 63 6b 20  |edirection back |
00001360  6f 6e 20 73 6f 20 74 68  61 74 20 74 68 65 20 73  |on so that the s|
00001370  65 72 76 65 72 20 63 61  6e 20 73 74 61 72 74 20  |erver can start |
00001380  6f 66 66 20 66 72 6f 6d  20 77 68 65 72 65 20 69  |off from where i|
00001390  74 20 66 69 6e 69 73 68  65 64 2e 3c 2f 50 3e 0a  |t finished.</P>.|
000013a0  0a 3c 48 52 20 57 49 44  54 48 3d 22 35 30 25 22  |.<HR WIDTH="50%"|
000013b0  3e 0a 0a 3c 41 20 4e 41  4d 45 3d 22 77 72 69 74  |>..<A NAME="writ|
000013c0  69 6e 67 22 3e 3c 48 32  3e 57 72 69 74 69 6e 67  |ing"><H2>Writing|
000013d0  20 43 47 49 20 50 72 6f  67 72 61 6d 73 3c 2f 48  | CGI Programs</H|
000013e0  32 3e 3c 2f 41 3e 0a 0a  3c 50 3e 57 72 69 74 69  |2></A>..<P>Writi|
000013f0  6e 67 20 43 47 49 20 70  72 6f 67 72 61 6d 73 20  |ng CGI programs |
00001400  66 6f 72 20 75 73 65 20  77 69 74 68 20 4e 65 74  |for use with Net|
00001410  70 6c 65 78 20 69 73 20  66 61 69 72 6c 79 20 65  |plex is fairly e|
00001420  61 73 79 2c 20 61 73 20  42 41 53 49 43 20 63 61  |asy, as BASIC ca|
00001430  6e 20 62 65 20 75 73 65  64 20 74 6f 20 69 6d 70  |n be used to imp|
00001440  6c 65 6d 65 6e 74 20 74  68 65 6d 20 71 75 69 63  |lement them quic|
00001450  6b 6c 79 2e 20 20 54 6f  20 73 74 61 72 74 20 77  |kly.  To start w|
00001460  69 74 68 20 61 6e 20 65  78 61 6d 70 6c 65 2c 20  |ith an example, |
00001470  68 65 72 65 27 73 20 61  20 57 65 62 2d 65 6e 61  |here's a Web-ena|
00001480  62 6c 65 64 20 48 65 6c  6c 6f 20 57 6f 72 6c 64  |bled Hello World|
00001490  20 70 72 6f 67 72 61 6d  20 3a 3c 2f 50 3e 0a 0a  | program :</P>..|
000014a0  3c 50 52 45 3e 3c 50 3e  0a 52 45 4d 20 3e 63 67  |<PRE><P>.REM >cg|
000014b0  69 2d 62 69 6e 2e 68 65  6c 6c 6f 77 6f 72 6c 64  |i-bin.helloworld|
000014c0  20 20 28 4e 65 74 70 6c  65 78 20 45 78 61 6d 70  |  (Netplex Examp|
000014d0  6c 65 20 31 29 0a 0a 50  52 49 4e 54 20 22 43 6f  |le 1)..PRINT "Co|
000014e0  6e 74 65 6e 74 2d 54 79  70 65 3a 20 74 65 78 74  |ntent-Type: text|
000014f0  2f 68 74 6d 6c 22 3b 43  48 52 24 28 31 33 29 3b  |/html";CHR$(13);|
00001500  43 48 52 24 28 31 30 29  3b 0a 50 52 49 4e 54 20  |CHR$(10);.PRINT |
00001510  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001520  20 20 20 20 20 20 20 20  20 20 43 48 52 24 28 31  |          CHR$(1|
00001530  33 29 3b 43 48 52 24 28  31 30 29 3b 0a 0a 50 52  |3);CHR$(10);..PR|
00001540  49 4e 54 20 22 26 6c 74  3b 48 54 4d 4c 26 67 74  |INT "&lt;HTML&gt|
00001550  3b 22 0a 50 52 49 4e 54  20 22 26 6c 74 3b 42 4f  |;".PRINT "&lt;BO|
00001560  44 59 26 67 74 3b 22 0a  50 52 49 4e 54 20 22 26  |DY&gt;".PRINT "&|
00001570  6c 74 3b 48 31 26 67 74  3b 48 65 6c 6c 6f 20 57  |lt;H1&gt;Hello W|
00001580  6f 72 6c 64 21 26 6c 74  3b 2f 48 31 26 67 74 3b  |orld!&lt;/H1&gt;|
00001590  22 0a 50 52 49 4e 54 20  22 26 6c 74 3b 2f 42 4f  |".PRINT "&lt;/BO|
000015a0  44 59 26 67 74 3b 22 0a  50 52 49 4e 54 20 22 26  |DY&gt;".PRINT "&|
000015b0  6c 74 3b 2f 48 54 4d 4c  26 67 74 3b 22 0a 0a 45  |lt;/HTML&gt;"..E|
000015c0  4e 44 0a 3c 2f 50 3e 3c  2f 50 52 45 3e 0a 0a 3c  |ND.</P></PRE>..<|
000015d0  50 3e 54 68 65 20 66 69  72 73 74 20 74 77 6f 20  |P>The first two |
000015e0  50 52 49 4e 54 20 73 74  61 74 65 6d 65 6e 74 73  |PRINT statements|
000015f0  20 61 72 65 20 70 61 72  74 20 6f 66 20 74 68 65  | are part of the|
00001600  20 68 65 61 64 65 72 20  74 68 61 74 20 69 73 20  | header that is |
00001610  73 65 6e 74 20 74 6f 20  74 68 65 20 63 6c 69 65  |sent to the clie|
00001620  6e 74 2e 20 20 54 68 65  20 66 69 72 73 74 20 6c  |nt.  The first l|
00001630  69 6e 65 20 74 65 6c 6c  73 20 74 68 65 20 63 6c  |ine tells the cl|
00001640  69 65 6e 74 20 74 68 61  74 20 74 68 65 20 64 6f  |ient that the do|
00001650  63 75 6d 65 6e 74 20 69  73 20 48 54 4d 4c 20 74  |cument is HTML t|
00001660  65 78 74 20 61 6e 64 20  74 68 65 20 73 65 63 6f  |ext and the seco|
00001670  6e 64 2c 20 65 6d 70 74  79 20 6c 69 6e 65 2c 20  |nd, empty line, |
00001680  74 65 72 6d 69 6e 61 74  65 73 20 74 68 65 20 68  |terminates the h|
00001690  65 61 64 65 72 2e 20 20  42 6f 74 68 20 6c 69 6e  |eader.  Both lin|
000016a0  65 73 20 61 72 65 20 74  65 72 6d 69 6e 61 74 65  |es are terminate|
000016b0  64 20 62 79 20 27 43 48  52 24 28 31 33 29 3b 43  |d by 'CHR$(13);C|
000016c0  48 52 24 28 31 30 29 3b  27 20 61 73 20 74 68 65  |HR$(10);' as the|
000016d0  20 75 73 75 61 6c 20 50  52 49 4e 54 20 6c 69 6e  | usual PRINT lin|
000016e0  65 20 65 6e 64 69 6e 67  20 69 73 20 69 6e 61 70  |e ending is inap|
000016f0  72 6f 70 72 69 61 74 65  20 66 6f 72 20 68 65 61  |ropriate for hea|
00001700  64 65 72 20 66 69 65 6c  64 73 20 77 68 69 63 68  |der fields which|
00001710  20 6d 75 73 74 20 62 65  20 74 65 72 6d 69 6e 61  | must be termina|
00001720  74 65 64 20 62 79 20 43  52 2c 4c 46 2e 20 20 54  |ted by CR,LF.  T|
00001730  68 65 20 6f 74 68 65 72  20 6c 69 6e 65 73 20 61  |he other lines a|
00001740  72 65 20 61 20 73 69 6d  70 6c 65 20 48 54 4d 4c  |re a simple HTML|
00001750  20 27 70 61 67 65 27 20  77 68 69 63 68 20 77 69  | 'page' which wi|
00001760  6c 6c 20 62 65 20 64 69  73 70 6c 61 79 65 64 20  |ll be displayed |
00001770  69 6e 20 74 68 65 20 62  72 6f 77 73 65 72 2e 3c  |in the browser.<|
00001780  2f 50 3e 0a 0a 3c 50 3e  41 73 20 66 61 72 20 61  |/P>..<P>As far a|
00001790  73 20 74 68 69 6e 67 73  20 67 6f 2c 20 74 68 69  |s things go, thi|
000017a0  73 20 70 72 6f 67 72 61  6d 20 69 73 6e 27 74 20  |s program isn't |
000017b0  76 65 72 79 20 69 6e 74  65 72 65 73 74 69 6e 67  |very interesting|
000017c0  20 2d 20 69 74 20 64 6f  65 73 6e 27 74 20 61 63  | - it doesn't ac|
000017d0  74 75 61 6c 6c 79 20 64  6f 20 61 6e 79 74 68 69  |tually do anythi|
000017e0  6e 67 20 3c 49 3e 64 69  66 66 65 72 65 6e 74 3c  |ng <I>different<|
000017f0  2f 49 3e 20 65 76 65 72  79 20 74 69 6d 65 20 79  |/I> every time y|
00001800  6f 75 20 72 75 6e 20 69  74 2c 20 77 68 69 63 68  |ou run it, which|
00001810  20 69 73 20 74 68 65 20  70 6f 69 6e 74 20 6f 66  | is the point of|
00001820  20 74 68 65 20 43 47 49  20 73 79 73 74 65 6d 2e  | the CGI system.|
00001830  20 20 41 6e 20 65 61 73  79 20 6d 6f 64 69 66 69  |  An easy modifi|
00001840  63 61 74 69 6f 6e 20 74  6f 20 6d 61 6b 65 20 69  |cation to make i|
00001850  74 20 70 72 6f 64 75 63  65 20 64 69 66 66 65 72  |t produce differ|
00001860  65 6e 74 20 6f 75 74 70  75 74 20 65 76 65 72 79  |ent output every|
00001870  20 74 69 6d 65 20 69 73  20 74 6f 20 72 65 70 6c  | time is to repl|
00001880  61 63 65 20 22 48 65 6c  6c 6f 20 57 6f 72 6c 64  |ace "Hello World|
00001890  21 22 20 77 69 74 68 20  54 49 4d 45 24 2c 20 77  |!" with TIME$, w|
000018a0  68 69 63 68 20 72 65 74  75 72 6e 73 20 74 68 65  |hich returns the|
000018b0  20 63 75 72 72 65 6e 74  20 74 69 6d 65 20 3a 3c  | current time :<|
000018c0  2f 50 3e 0a 0a 3c 50 52  45 3e 3c 50 3e 0a 52 45  |/P>..<PRE><P>.RE|
000018d0  4d 20 3e 63 67 69 2d 62  69 6e 2e 74 69 6d 65 20  |M >cgi-bin.time |
000018e0  20 28 4e 65 74 70 6c 65  78 20 45 78 61 6d 70 6c  | (Netplex Exampl|
000018f0  65 20 32 29 0a 0a 50 52  49 4e 54 20 22 43 6f 6e  |e 2)..PRINT "Con|
00001900  74 65 6e 74 2d 54 79 70  65 3a 20 74 65 78 74 2f  |tent-Type: text/|
00001910  68 74 6d 6c 22 3b 43 48  52 24 28 31 33 29 3b 43  |html";CHR$(13);C|
00001920  48 52 24 28 31 30 29 3b  0a 50 52 49 4e 54 20 20  |HR$(10);.PRINT  |
00001930  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001940  20 20 20 20 20 20 20 20  20 43 48 52 24 28 31 33  |         CHR$(13|
00001950  29 3b 43 48 52 24 28 31  30 29 3b 0a 0a 50 52 49  |);CHR$(10);..PRI|
00001960  4e 54 20 22 26 6c 74 3b  48 54 4d 4c 26 67 74 3b  |NT "&lt;HTML&gt;|
00001970  22 0a 50 52 49 4e 54 20  22 26 6c 74 3b 42 4f 44  |".PRINT "&lt;BOD|
00001980  59 26 67 74 3b 22 0a 50  52 49 4e 54 20 22 26 6c  |Y&gt;".PRINT "&l|
00001990  74 3b 48 31 26 67 74 3b  22 2b 54 49 4d 45 24 2b  |t;H1&gt;"+TIME$+|
000019a0  22 26 6c 74 3b 2f 48 31  26 67 74 3b 22 0a 50 52  |"&lt;/H1&gt;".PR|
000019b0  49 4e 54 20 22 26 6c 74  3b 2f 42 4f 44 59 26 67  |INT "&lt;/BODY&g|
000019c0  74 3b 22 0a 50 52 49 4e  54 20 22 26 6c 74 3b 2f  |t;".PRINT "&lt;/|
000019d0  48 54 4d 4c 26 67 74 3b  22 0a 0a 45 4e 44 0a 3c  |HTML&gt;"..END.<|
000019e0  2f 50 3e 3c 2f 50 52 45  3e 0a 0a 3c 50 3e 4e 6f  |/P></PRE>..<P>No|
000019f0  77 2c 20 77 68 65 6e 20  74 68 65 20 70 72 6f 67  |w, when the prog|
00001a00  72 61 6d 20 69 73 20 66  65 74 63 68 65 64 2c 20  |ram is fetched, |
00001a10  69 74 20 77 69 6c 6c 20  72 65 74 75 72 6e 20 74  |it will return t|
00001a20  68 65 20 63 75 72 72 65  6e 74 20 74 69 6d 65 2e  |he current time.|
00001a30  3c 2f 50 3e 0a 0a 3c 50  3e 54 6f 20 6c 65 61 72  |</P>..<P>To lear|
00001a40  6e 20 6d 6f 72 65 20 61  62 6f 75 74 20 43 47 49  |n more about CGI|
00001a50  20 70 72 6f 67 72 61 6d  6d 69 6e 67 2c 20 79 6f  | programming, yo|
00001a60  75 20 73 68 6f 75 6c 64  20 65 78 61 6d 69 6e 65  |u should examine|
00001a70  20 74 68 65 20 3c 41 20  48 52 45 46 3d 22 23 65  | the <A HREF="#e|
00001a80  78 61 6d 70 6c 65 73 22  3e 65 78 61 6d 70 6c 65  |xamples">example|
00001a90  73 3c 2f 41 3e 20 67 69  76 65 6e 20 62 65 6c 6f  |s</A> given belo|
00001aa0  77 2e 3c 2f 50 3e 0a 0a  0a 3c 48 33 3e 54 68 65  |w.</P>...<H3>The|
00001ab0  20 43 47 49 20 4c 69 62  72 61 72 79 3c 2f 48 33  | CGI Library</H3|
00001ac0  3e 0a 3c 50 3e 41 20 42  41 53 49 43 20 6c 69 62  |>.<P>A BASIC lib|
00001ad0  72 61 72 79 20 63 6f 6e  74 61 69 6e 69 6e 67 20  |rary containing |
00001ae0  72 6f 75 74 69 6e 65 73  20 66 6f 72 20 75 73 65  |routines for use|
00001af0  20 69 6e 20 43 47 49 20  70 72 6f 67 72 61 6d 73  | in CGI programs|
00001b00  20 69 73 20 70 72 6f 76  69 64 65 64 2e 20 20 4e  | is provided.  N|
00001b10  6f 74 65 20 74 68 61 74  20 74 68 65 20 6c 69 62  |ote that the lib|
00001b20  72 61 72 79 20 69 73 20  6e 6f 74 20 70 72 6f 76  |rary is not prov|
00001b30  69 64 65 64 20 73 69 6d  70 6c 79 20 74 6f 20 6d  |ided simply to m|
00001b40  61 6b 65 20 74 68 65 20  6a 6f 62 20 6f 66 20 70  |ake the job of p|
00001b50  72 6f 67 72 61 6d 6d 69  6e 67 20 43 47 49 20 65  |rogramming CGI e|
00001b60  61 73 69 65 72 2c 20 69  74 20 63 6f 6e 74 61 69  |asier, it contai|
00001b70  6e 73 20 73 75 70 70 6f  72 74 20 63 6f 64 65 20  |ns support code |
00001b80  77 68 69 63 68 20 69 73  20 65 73 73 65 6e 74 69  |which is essenti|
00001b90  61 6c 20 74 6f 20 65 6e  73 75 72 65 20 74 68 65  |al to ensure the|
00001ba0  20 63 6f 72 72 65 63 74  20 6f 70 65 72 61 74 69  | correct operati|
00001bb0  6f 6e 20 6f 66 20 74 68  65 20 73 65 72 76 65 72  |on of the server|
00001bc0  20 77 68 65 6e 20 64 65  61 6c 69 6e 67 20 77 69  | when dealing wi|
00001bd0  74 68 20 43 47 49 20 70  72 6f 67 72 61 6d 73 2e  |th CGI programs.|
00001be0  20 20 49 66 20 79 6f 75  20 61 72 65 20 74 68 69  |  If you are thi|
00001bf0  6e 6b 69 6e 67 20 6f 66  20 70 72 6f 67 72 61 6d  |nking of program|
00001c00  6d 69 6e 67 20 66 6f 72  20 4e 65 74 70 6c 65 78  |ming for Netplex|
00001c10  20 69 6e 20 6f 74 68 65  72 20 6c 61 6e 67 75 61  | in other langua|
00001c20  67 65 73 20 74 68 65 6e  20 79 6f 75 20 73 68 6f  |ges then you sho|
00001c30  75 6c 64 20 69 6d 70 6c  65 6d 65 6e 74 20 61 6e  |uld implement an|
00001c40  20 65 71 75 69 76 61 6c  65 6e 74 20 6f 66 20 74  | equivalent of t|
00001c50  68 65 20 43 47 49 4c 69  62 72 61 72 79 2e 3c 2f  |he CGILibrary.</|
00001c60  50 3e 0a 0a 3c 50 3e 54  6f 20 75 73 65 20 74 68  |P>..<P>To use th|
00001c70  65 20 43 47 49 4c 69 62  72 61 72 79 2c 20 79 6f  |e CGILibrary, yo|
00001c80  75 20 73 68 6f 75 6c 64  20 75 73 65 20 74 68 65  |u should use the|
00001c90  20 66 6f 6c 6c 6f 77 69  6e 67 20 69 6e 73 74 72  | following instr|
00001ca0  75 63 74 69 6f 6e 73 20  61 74 20 74 68 65 20 73  |uctions at the s|
00001cb0  74 61 72 74 20 6f 66 20  79 6f 75 72 20 70 72 6f  |tart of your pro|
00001cc0  67 72 61 6d 20 3a 3c 2f  50 3e 0a 0a 3c 50 3e 3c  |gram :</P>..<P><|
00001cd0  50 52 45 3e 0a 4c 49 42  52 41 52 59 20 22 26 6c  |PRE>.LIBRARY "&l|
00001ce0  74 3b 4e 65 74 70 6c 65  78 24 44 69 72 26 67 74  |t;Netplex$Dir&gt|
00001cf0  3b 2e 43 47 49 4c 69 62  72 61 72 79 22 0a 50 52  |;.CGILibrary".PR|
00001d00  4f 43 63 67 69 5f 69 6e  69 74 0a 3c 2f 50 3e 3c  |OCcgi_init.</P><|
00001d10  2f 50 52 45 3e 0a 0a 3c  50 3e 54 68 69 73 20 77  |/PRE>..<P>This w|
00001d20  69 6c 6c 20 73 65 74 20  75 70 20 61 6e 20 65 72  |ill set up an er|
00001d30  72 6f 72 20 68 61 6e 64  6c 65 72 2c 20 64 69 6d  |ror handler, dim|
00001d40  65 6e 73 69 6f 6e 20 61  20 32 35 36 2d 62 79 74  |ension a 256-byt|
00001d50  65 20 62 6c 6f 63 6b 20  6f 66 20 6d 65 6d 6f 72  |e block of memor|
00001d60  79 20 63 61 6c 6c 65 64  20 6d 69 73 63 25 20 61  |y called misc% a|
00001d70  6e 64 20 77 69 6c 6c 20  73 65 74 20 74 68 65 20  |nd will set the |
00001d80  76 61 72 69 61 62 6c 65  73 20 63 67 69 5f 69 6e  |variables cgi_in|
00001d90  25 20 61 6e 64 20 63 67  69 5f 6f 75 74 25 20 74  |% and cgi_out% t|
00001da0  6f 20 74 68 65 20 68 61  6e 64 6c 65 73 20 6f 66  |o the handles of|
00001db0  20 74 68 65 20 69 6e 70  75 74 20 61 6e 64 20 6f  | the input and o|
00001dc0  75 74 70 75 74 20 64 61  74 61 20 73 74 72 65 61  |utput data strea|
00001dd0  6d 73 20 72 65 73 70 65  63 74 69 76 65 6c 79 2e  |ms respectively.|
00001de0  3c 2f 50 3e 0a 0a 3c 50  3e 59 6f 75 20 73 68 6f  |</P>..<P>You sho|
00001df0  75 6c 64 20 63 61 6c 6c  20 74 68 65 20 72 6f 75  |uld call the rou|
00001e00  74 69 6e 65 20 50 52 4f  43 63 67 69 5f 63 6c 6f  |tine PROCcgi_clo|
00001e10  73 65 64 6f 77 6e 20 61  74 20 74 68 65 20 65 6e  |sedown at the en|
00001e20  64 20 6f 66 20 79 6f 75  72 20 70 72 6f 67 72 61  |d of your progra|
00001e30  6d 2e 3c 2f 50 3e 0a 0a  3c 50 3e 54 68 65 20 6c  |m.</P>..<P>The l|
00001e40  69 62 72 61 72 79 20 70  72 6f 76 69 64 65 73 20  |ibrary provides |
00001e50  74 68 65 20 66 6f 6c 6c  6f 77 69 6e 67 20 72 6f  |the following ro|
00001e60  75 74 69 6e 65 73 20 3a  3c 2f 50 3e 0a 3c 44 4c  |utines :</P>.<DL|
00001e70  3e 0a 0a 3c 44 54 3e 3c  42 3e 50 52 4f 43 63 67  |>..<DT><B>PROCcg|
00001e80  69 5f 68 65 61 64 65 72  28 63 6f 6e 74 65 6e 74  |i_header(content|
00001e90  5f 74 79 70 65 24 2c 20  63 6f 6e 74 65 6e 74 5f  |_type$, content_|
00001ea0  6c 65 6e 67 74 68 25 29  3c 2f 42 3e 0a 3c 44 44  |length%)</B>.<DD|
00001eb0  3e 47 69 76 65 6e 20 74  68 65 20 43 6f 6e 74 65  |>Given the Conte|
00001ec0  6e 74 2d 54 79 70 65 20  61 6e 64 20 43 6f 6e 74  |nt-Type and Cont|
00001ed0  65 6e 74 2d 4c 65 6e 67  74 68 2c 20 74 68 69 73  |ent-Length, this|
00001ee0  20 72 6f 75 74 69 6e 65  20 67 65 6e 65 72 61 74  | routine generat|
00001ef0  65 73 20 61 6e 20 61 70  70 72 6f 70 72 69 61 74  |es an appropriat|
00001f00  65 20 72 65 73 70 6f 6e  73 65 20 68 65 61 64 65  |e response heade|
00001f10  72 2e 20 20 43 6f 6e 74  65 6e 74 5f 74 79 70 65  |r.  Content_type|
00001f20  24 20 69 73 20 67 69 76  65 6e 20 61 73 20 27 69  |$ is given as 'i|
00001f30  6d 61 67 65 2f 67 69 66  27 2c 20 27 74 65 78 74  |mage/gif', 'text|
00001f40  2f 68 74 6d 6c 27 2c 20  65 74 63 2e 20 20 43 6f  |/html', etc.  Co|
00001f50  6e 74 65 6e 74 5f 6c 65  6e 67 74 68 25 20 69 73  |ntent_length% is|
00001f60  20 74 68 65 20 61 6d 6f  75 6e 74 20 6f 66 20 64  | the amount of d|
00001f70  61 74 61 20 79 6f 75 20  61 72 65 20 67 6f 69 6e  |ata you are goin|
00001f80  67 20 74 6f 20 62 65 20  73 65 6e 64 69 6e 67 2c  |g to be sending,|
00001f90  20 6f 72 20 2d 31 20 69  66 20 79 6f 75 20 64 6f  | or -1 if you do|
00001fa0  6e 27 74 20 6b 6e 6f 77  2e 0a 0a 3c 44 54 3e 3c  |n't know...<DT><|
00001fb0  42 3e 50 52 4f 43 63 67  69 5f 73 74 61 74 75 73  |B>PROCcgi_status|
00001fc0  6c 69 6e 65 28 63 6f 64  65 25 2c 20 70 68 72 61  |line(code%, phra|
00001fd0  73 65 24 29 3c 2f 42 3e  0a 3c 44 44 3e 49 66 20  |se$)</B>.<DD>If |
00001fe0  79 6f 75 20 6e 65 65 64  20 74 6f 2c 20 79 6f 75  |you need to, you|
00001ff0  20 6d 61 79 20 67 65 6e  65 72 61 74 65 20 61 6e  | may generate an|
00002000  20 65 6e 74 69 72 65 20  48 54 54 50 20 72 65 73  | entire HTTP res|
00002010  70 6f 6e 73 65 20 79 6f  75 72 73 65 6c 66 2c 20  |ponse yourself, |
00002020  69 6e 63 6c 75 64 69 6e  67 20 68 65 61 64 65 72  |including header|
00002030  73 2e 20 20 63 67 69 5f  73 74 61 74 75 73 6c 69  |s.  cgi_statusli|
00002040  6e 65 20 6f 75 74 70 75  74 73 20 74 68 65 20 69  |ne outputs the i|
00002050  6e 69 74 69 61 6c 20 48  54 54 50 20 73 74 61 74  |nitial HTTP stat|
00002060  75 73 20 6c 69 6e 65 2c  20 77 68 69 63 68 20 69  |us line, which i|
00002070  6e 66 6f 72 6d 73 20 74  68 65 20 72 65 63 69 70  |nforms the recip|
00002080  69 65 6e 74 20 6f 66 20  74 68 65 20 76 65 72 73  |ient of the vers|
00002090  69 6f 6e 20 6f 66 20 48  54 54 50 20 69 6e 20 75  |ion of HTTP in u|
000020a0  73 65 2c 20 74 68 65 20  72 65 73 70 6f 6e 73 65  |se, the response|
000020b0  20 73 74 61 74 75 73 20  63 6f 64 65 20 61 6e 64  | status code and|
000020c0  20 61 20 73 68 6f 72 74  20 70 68 72 61 73 65 20  | a short phrase |
000020d0  69 6e 64 69 63 61 74 69  6e 67 20 74 68 65 20 73  |indicating the s|
000020e0  65 72 76 65 72 27 73 20  72 65 73 70 6f 6e 73 65  |erver's response|
000020f0  2e 20 20 59 6f 75 20 6d  75 73 74 20 63 61 6c 6c  |.  You must call|
00002100  20 63 67 69 5f 73 74 61  74 75 73 6c 69 6e 65 20  | cgi_statusline |
00002110  62 65 66 6f 72 65 20 61  6e 79 74 68 69 6e 67 20  |before anything |
00002120  65 6c 73 65 20 74 68 61  74 20 77 69 6c 6c 20 63  |else that will c|
00002130  61 75 73 65 20 6f 75 74  70 75 74 2e 0a 0a 3c 44  |ause output...<D|
00002140  54 3e 3c 42 3e 50 52 4f  43 63 67 69 5f 68 65 61  |T><B>PROCcgi_hea|
00002150  64 65 72 6c 69 6e 65 28  6e 61 6d 65 24 2c 20 76  |derline(name$, v|
00002160  61 6c 75 65 24 29 3c 2f  42 3e 0a 3c 44 44 3e 54  |alue$)</B>.<DD>T|
00002170  68 69 73 20 72 6f 75 74  69 6e 65 20 74 61 6b 65  |his routine take|
00002180  73 20 63 61 72 65 20 6f  66 20 6f 75 74 70 75 74  |s care of output|
00002190  74 69 6e 67 20 48 54 54  50 20 68 65 61 64 65 72  |ting HTTP header|
000021a0  73 20 77 69 74 68 20 74  68 65 20 63 6f 72 72 65  |s with the corre|
000021b0  63 74 20 6c 69 6e 65 20  65 6e 64 69 6e 67 73 2e  |ct line endings.|
000021c0  20 20 4e 61 6d 65 24 20  69 73 20 74 68 65 20 6e  |  Name$ is the n|
000021d0  61 6d 65 20 6f 66 20 74  68 65 20 68 65 61 64 65  |ame of the heade|
000021e0  72 20 66 69 65 6c 64 20  61 6e 64 20 76 61 6c 75  |r field and valu|
000021f0  65 24 20 69 73 20 69 74  73 20 76 61 6c 75 65 2c  |e$ is its value,|
00002200  20 73 6f 20 63 67 69 5f  68 65 61 64 65 72 6c 69  | so cgi_headerli|
00002210  6e 65 28 22 43 6f 6f 6b  69 65 22 2c 22 6e 61 6d  |ne("Cookie","nam|
00002220  65 3d 63 6f 6f 6b 69 65  5f 6d 6f 6e 73 74 65 72  |e=cookie_monster|
00002230  22 29 20 77 69 6c 6c 20  67 65 6e 65 72 61 74 65  |") will generate|
00002240  20 74 68 65 20 68 65 61  64 65 72 20 6c 69 6e 65  | the header line|
00002250  20 22 43 6f 6f 6b 69 65  3a 20 6e 61 6d 65 3d 63  | "Cookie: name=c|
00002260  6f 6f 6b 69 65 5f 6d 6f  6e 73 74 65 72 22 2e 20  |ookie_monster". |
00002270  20 49 66 20 6e 61 6d 65  24 20 69 73 20 61 6e 20  | If name$ is an |
00002280  65 6d 70 74 79 20 73 74  72 69 6e 67 2c 20 74 68  |empty string, th|
00002290  65 6e 20 63 67 69 5f 68  65 61 64 65 72 6c 69 6e  |en cgi_headerlin|
000022a0  65 20 77 69 6c 6c 20 6f  75 74 70 75 74 20 61 6e  |e will output an|
000022b0  20 65 6d 70 74 79 20 6c  69 6e 65 20 73 6f 20 74  | empty line so t|
000022c0  68 61 74 20 74 68 65 20  68 65 61 64 65 72 20 77  |hat the header w|
000022d0  69 6c 6c 20 62 65 20 74  65 72 6d 69 6e 61 74 65  |ill be terminate|
000022e0  64 2e 0a 0a 3c 44 54 3e  3c 42 3e 50 52 4f 43 63  |d...<DT><B>PROCc|
000022f0  67 69 5f 65 72 72 6f 72  3c 2f 42 3e 0a 3c 44 44  |gi_error</B>.<DD|
00002300  3e 54 68 69 73 20 69 73  20 61 75 74 6f 6d 61 74  |>This is automat|
00002310  69 63 61 6c 6c 79 20 63  61 6c 6c 65 64 20 77 68  |ically called wh|
00002320  65 6e 20 61 6e 20 65 72  72 6f 72 20 6f 63 63 75  |en an error occu|
00002330  72 73 2e 20 20 49 74 20  63 6c 65 61 6e 73 20 75  |rs.  It cleans u|
00002340  70 20 61 6e 79 20 74 65  6d 70 6f 72 61 72 79 20  |p any temporary |
00002350  66 69 6c 65 73 20 61 6e  64 20 6f 75 74 70 75 74  |files and output|
00002360  73 20 61 6e 20 48 54 4d  4c 20 70 61 67 65 20 64  |s an HTML page d|
00002370  65 73 63 72 69 62 69 6e  67 20 74 68 65 20 65 72  |escribing the er|
00002380  72 6f 72 20 74 6f 20 74  68 65 20 63 6c 69 65 6e  |ror to the clien|
00002390  74 2e 20 20 54 68 65 20  65 72 72 6f 72 20 6d 65  |t.  The error me|
000023a0  73 73 61 67 65 20 69 73  20 61 6c 73 6f 20 72 65  |ssage is also re|
000023b0  63 6f 72 64 65 64 20 69  6e 20 74 68 65 20 6c 6f  |corded in the lo|
000023c0  67 20 66 69 6c 65 2e 0a  0a 3c 44 54 3e 3c 42 3e  |g file...<DT><B>|
000023d0  46 4e 63 67 69 5f 6e 65  78 74 65 6c 65 6d 65 6e  |FNcgi_nextelemen|
000023e0  74 3c 2f 42 3e 0a 3c 44  44 3e 52 65 74 75 72 6e  |t</B>.<DD>Return|
000023f0  73 20 74 68 65 20 6e 65  78 74 20 70 61 72 61 6d  |s the next param|
00002400  65 74 65 72 20 70 61 73  73 65 64 20 74 6f 20 74  |eter passed to t|
00002410  68 65 20 70 72 6f 67 72  61 6d 20 28 50 4f 53 54  |he program (POST|
00002420  20 6f 6e 6c 79 29 2e 0a  0a 3c 44 54 3e 3c 42 3e  | only)...<DT><B>|
00002430  46 4e 63 67 69 5f 6e 65  78 74 65 6c 65 6d 65 6e  |FNcgi_nextelemen|
00002440  74 64 65 63 6f 64 65 64  3c 2f 42 3e 0a 3c 44 44  |tdecoded</B>.<DD|
00002450  3e 41 73 20 61 62 6f 76  65 2c 20 62 75 74 20 74  |>As above, but t|
00002460  72 61 6e 73 6c 61 74 65  73 20 61 6c 6c 20 6f 66  |ranslates all of|
00002470  20 74 68 65 20 65 73 63  61 70 65 20 63 6f 64 65  | the escape code|
00002480  73 20 66 69 72 73 74 2c  20 62 79 20 63 61 6c 6c  |s first, by call|
00002490  69 6e 67 20 46 4e 63 67  69 5f 64 65 63 6f 64 65  |ing FNcgi_decode|
000024a0  65 6c 65 6d 65 6e 74 2e  0a 0a 3c 44 54 3e 3c 42  |element...<DT><B|
000024b0  3e 46 4e 63 67 69 5f 64  65 63 6f 64 65 65 6c 65  |>FNcgi_decodeele|
000024c0  6d 65 6e 74 28 65 24 29  3c 2f 42 3e 0a 3c 44 44  |ment(e$)</B>.<DD|
000024d0  3e 54 72 61 6e 73 6c 61  74 65 73 20 61 6c 6c 20  |>Translates all |
000024e0  74 68 65 20 65 73 63 61  70 65 20 63 68 61 72 61  |the escape chara|
000024f0  63 74 65 72 73 20 28 65  2e 67 2e 20 27 25 37 65  |cters (e.g. '%7e|
00002500  27 29 20 69 6e 20 65 24  2c 20 61 6e 64 20 72 65  |') in e$, and re|
00002510  74 75 72 6e 73 20 74 68  65 20 74 72 61 6e 73 6c  |turns the transl|
00002520  61 74 65 64 20 73 74 72  69 6e 67 2e 0a 0a 3c 44  |ated string...<D|
00002530  54 3e 3c 42 3e 50 52 4f  43 63 67 69 5f 72 65 64  |T><B>PROCcgi_red|
00002540  69 72 65 63 74 28 6f 6e  25 29 3c 2f 42 3e 0a 3c  |irect(on%)</B>.<|
00002550  44 44 3e 55 70 64 61 74  65 73 20 74 68 65 20 63  |DD>Updates the c|
00002560  67 69 5f 69 6e 25 20 61  6e 64 20 63 67 69 5f 6f  |gi_in% and cgi_o|
00002570  75 74 25 20 76 61 72 69  61 62 6c 65 73 2e 20 20  |ut% variables.  |
00002580  49 66 20 6f 6e 25 20 69  73 20 46 41 4c 53 45 2c  |If on% is FALSE,|
00002590  20 74 68 65 6e 20 72 65  64 69 72 65 63 74 69 6f  | then redirectio|
000025a0  6e 20 69 73 20 74 75 72  6e 65 64 20 6f 66 66 20  |n is turned off |
000025b0  77 68 69 63 68 20 69 73  20 6e 65 63 65 73 73 61  |which is necessa|
000025c0  72 79 20 77 69 74 68 20  6d 75 6c 74 69 74 61 73  |ry with multitas|
000025d0  6b 69 6e 67 20 43 47 49  20 70 72 6f 67 72 61 6d  |king CGI program|
000025e0  73 2e 0a 0a 3c 44 54 3e  3c 42 3e 50 52 4f 43 63  |s...<DT><B>PROCc|
000025f0  67 69 5f 70 6f 6c 6c 69  6e 67 28 6f 6e 25 29 3c  |gi_polling(on%)<|
00002600  2f 42 3e 0a 3c 44 44 3e  53 65 74 73 20 6f 72 20  |/B>.<DD>Sets or |
00002610  75 6e 73 65 74 73 20 28  64 65 70 65 6e 64 69 6e  |unsets (dependin|
00002620  67 20 6f 6e 20 6f 6e 25  29 20 61 20 73 79 73 74  |g on on%) a syst|
00002630  65 6d 20 76 61 72 69 61  62 6c 65 20 28 22 43 47  |em variable ("CG|
00002640  49 24 41 63 74 69 76 65  5f 2e 2e 2e 22 29 20 77  |I$Active_...") w|
00002650  68 69 63 68 20 6c 65 74  73 20 4e 65 74 70 6c 65  |hich lets Netple|
00002660  78 20 6b 6e 6f 77 20 74  68 61 74 20 74 68 65 20  |x know that the |
00002670  43 47 49 20 70 72 6f 67  72 61 6d 20 69 6e 74 65  |CGI program inte|
00002680  6e 64 73 20 74 6f 20 6d  75 6c 74 69 74 61 73 6b  |nds to multitask|
00002690  2e 20 20 49 66 20 79 6f  75 20 69 6e 74 65 6e 64  |.  If you intend|
000026a0  20 74 6f 20 63 61 6c 6c  20 57 69 6d 70 5f 50 6f  | to call Wimp_Po|
000026b0  6c 6c 20 69 6e 20 79 6f  75 72 20 70 72 6f 67 72  |ll in your progr|
000026c0  61 6d 2c 20 79 6f 75 20  3c 42 3e 6d 75 73 74 3c  |am, you <B>must<|
000026d0  2f 42 3e 20 63 61 6c 6c  20 50 52 4f 43 63 67 69  |/B> call PROCcgi|
000026e0  5f 70 6f 6c 6c 69 6e 67  28 54 52 55 45 29 20 62  |_polling(TRUE) b|
000026f0  65 66 6f 72 65 20 79 6f  75 20 64 6f 2c 20 61 6e  |efore you do, an|
00002700  64 20 63 61 6c 6c 20 50  52 4f 43 63 67 69 5f 70  |d call PROCcgi_p|
00002710  6f 6c 6c 69 6e 67 28 46  41 4c 53 45 29 20 62 65  |olling(FALSE) be|
00002720  66 6f 72 65 20 74 68 65  20 65 6e 64 20 6f 66 20  |fore the end of |
00002730  79 6f 75 72 20 70 72 6f  67 72 61 6d 2e 3c 2f 50  |your program.</P|
00002740  3e 0a 0a 3c 44 54 3e 3c  42 3e 46 4e 6d 69 6d 65  |>..<DT><B>FNmime|
00002750  28 66 69 6c 65 74 79 70  65 25 29 3c 2f 42 3e 0a  |(filetype%)</B>.|
00002760  3c 44 44 3e 43 6f 6e 76  65 72 74 73 20 61 20 66  |<DD>Converts a f|
00002770  69 6c 65 74 79 70 65 20  74 6f 20 61 20 4d 49 4d  |iletype to a MIM|
00002780  45 20 43 6f 6e 74 65 6e  74 2d 54 79 70 65 2e 0a  |E Content-Type..|
00002790  0a 3c 44 54 3e 3c 42 3e  46 4e 73 74 72 69 6e 67  |.<DT><B>FNstring|
000027a0  5f 72 65 61 64 74 6f 63  74 72 6c 28 52 45 54 55  |_readtoctrl(RETU|
000027b0  52 4e 20 70 25 29 3c 2f  42 3e 0a 3c 44 44 3e 52  |RN p%)</B>.<DD>R|
000027c0  65 74 75 72 6e 73 20 74  68 65 20 73 74 72 69 6e  |eturns the strin|
000027d0  67 20 70 6f 69 6e 74 65  64 20 74 6f 20 62 79 20  |g pointed to by |
000027e0  70 25 2c 20 61 6e 64 20  75 70 64 61 74 65 73 20  |p%, and updates |
000027f0  70 25 20 74 6f 20 70 6f  69 6e 74 20 74 6f 20 74  |p% to point to t|
00002800  68 65 20 66 69 72 73 74  20 75 6e 72 65 61 64 20  |he first unread |
00002810  63 68 61 72 61 63 74 65  72 2e 0a 0a 3c 44 54 3e  |character...<DT>|
00002820  3c 42 3e 46 4e 63 61 73  65 5f 6c 6f 77 65 72 28  |<B>FNcase_lower(|
00002830  73 24 29 3c 2f 42 3e 0a  3c 44 44 3e 52 65 74 75  |s$)</B>.<DD>Retu|
00002840  72 6e 73 20 74 68 65 20  67 69 76 65 6e 20 73 74  |rns the given st|
00002850  72 69 6e 67 2c 20 69 6e  20 6c 6f 77 65 72 20 63  |ring, in lower c|
00002860  61 73 65 2e 0a 0a 3c 44  54 3e 3c 42 3e 46 4e 63  |ase...<DT><B>FNc|
00002870  61 73 65 5f 75 70 70 65  72 28 73 24 29 3c 2f 42  |ase_upper(s$)</B|
00002880  3e 0a 3c 44 44 3e 52 65  74 75 72 6e 73 20 74 68  |>.<DD>Returns th|
00002890  65 20 67 69 76 65 6e 20  73 74 72 69 6e 67 2c 20  |e given string, |
000028a0  69 6e 20 75 70 70 65 72  20 63 61 73 65 2e 0a 0a  |in upper case...|
000028b0  3c 44 54 3e 3c 42 3e 50  52 4f 43 73 79 73 74 65  |<DT><B>PROCsyste|
000028c0  6d 5f 73 65 74 6c 69 74  65 72 61 6c 28 76 61 72  |m_setliteral(var|
000028d0  24 2c 20 76 61 6c 24 29  3c 2f 42 3e 0a 3c 44 44  |$, val$)</B>.<DD|
000028e0  3e 53 65 74 73 20 74 68  65 20 73 79 73 74 65 6d  |>Sets the system|
000028f0  20 76 61 72 69 61 62 6c  65 20 76 61 72 24 20 61  | variable var$ a|
00002900  73 20 73 74 72 69 6e 67  20 76 61 6c 24 2e 0a 0a  |s string val$...|
00002910  3c 44 54 3e 3c 42 3e 46  4e 73 79 73 74 65 6d 5f  |<DT><B>FNsystem_|
00002920  67 65 74 76 61 72 28 76  61 72 24 29 3c 2f 42 3e  |getvar(var$)</B>|
00002930  0a 3c 44 44 3e 52 65 74  75 72 6e 73 20 74 68 65  |.<DD>Returns the|
00002940  20 73 79 73 74 65 6d 20  76 61 72 69 61 62 6c 65  | system variable|
00002950  20 76 61 72 24 20 61 73  20 61 20 73 74 72 69 6e  | var$ as a strin|
00002960  67 2e 0a 0a 3c 44 54 3e  3c 42 3e 46 4e 73 79 73  |g...<DT><B>FNsys|
00002970  74 65 6d 5f 75 6e 73 65  74 28 76 61 72 24 29 3c  |tem_unset(var$)<|
00002980  2f 42 3e 0a 3c 44 44 3e  55 6e 73 65 74 73 20 74  |/B>.<DD>Unsets t|
00002990  68 65 20 73 79 73 74 65  6d 20 76 61 72 69 61 62  |he system variab|
000029a0  6c 65 20 76 61 72 24 2e  0a 0a 3c 2f 44 4c 3e 0a  |le var$...</DL>.|
000029b0  0a 0a 3c 48 33 3e 43 47  49 20 53 79 73 74 65 6d  |..<H3>CGI System|
000029c0  20 56 61 72 69 61 62 6c  65 73 3c 2f 48 33 3e 0a  | Variables</H3>.|
000029d0  0a 3c 50 3e 4e 65 74 70  6c 65 78 20 70 61 73 73  |.<P>Netplex pass|
000029e0  65 73 20 69 6e 66 6f 72  6d 61 74 69 6f 6e 20 74  |es information t|
000029f0  6f 20 43 47 49 20 70 72  6f 67 72 61 6d 73 20 76  |o CGI programs v|
00002a00  69 61 20 61 20 73 65 74  20 6f 66 20 73 79 73 74  |ia a set of syst|
00002a10  65 6d 20 76 61 72 69 61  62 6c 65 73 2c 20 77 68  |em variables, wh|
00002a20  69 63 68 20 75 73 65 20  74 68 65 20 70 72 65 66  |ich use the pref|
00002a30  69 78 65 73 20 27 43 47  49 24 27 20 61 6e 64 20  |ixes 'CGI$' and |
00002a40  27 48 54 54 50 24 27 2e  20 20 4e 6f 74 65 20 74  |'HTTP$'.  Note t|
00002a50  68 61 74 20 74 68 69 73  20 69 73 20 64 69 66 66  |hat this is diff|
00002a60  65 72 65 6e 74 20 74 6f  20 43 47 49 20 6f 6e 20  |erent to CGI on |
00002a70  6e 6f 6e 2d 52 49 53 43  20 4f 53 20 73 65 72 76  |non-RISC OS serv|
00002a80  65 72 73 20 77 68 69 63  68 20 68 61 76 65 20 64  |ers which have d|
00002a90  69 66 66 65 72 65 6e 74  20 72 75 6c 65 73 20 72  |ifferent rules r|
00002aa0  65 67 61 72 64 69 6e 67  20 73 79 73 74 65 6d 20  |egarding system |
00002ab0  76 61 72 69 61 62 6c 65  73 2e 20 20 46 6f 72 20  |variables.  For |
00002ac0  65 78 61 6d 70 6c 65 2c  20 43 47 49 24 53 65 72  |example, CGI$Ser|
00002ad0  76 65 72 53 6f 66 74 77  61 72 65 20 69 73 20 75  |verSoftware is u|
00002ae0  73 65 64 20 72 61 74 68  65 72 20 74 68 61 6e 20  |sed rather than |
00002af0  53 45 52 56 45 52 5f 53  4f 46 54 57 41 52 45 2e  |SERVER_SOFTWARE.|
00002b00  20 20 54 68 69 73 20 6d  65 61 6e 73 20 74 68 61  |  This means tha|
00002b10  74 20 61 6e 79 6f 6e 65  20 70 6f 72 74 69 6e 67  |t anyone porting|
00002b20  20 43 47 49 20 73 6f 66  74 77 61 72 65 20 6f 72  | CGI software or|
00002b30  20 73 63 72 69 70 74 73  20 66 72 6f 6d 20 6f 74  | scripts from ot|
00002b40  68 65 72 20 70 6c 61 74  66 6f 72 6d 73 20 6d 75  |her platforms mu|
00002b50  73 74 20 74 61 6b 65 20  74 68 69 73 20 69 6e 74  |st take this int|
00002b60  6f 20 61 63 63 6f 75 6e  74 2c 20 61 6e 64 20 61  |o account, and a|
00002b70  64 6a 75 73 74 20 61 6c  6c 20 72 65 66 65 72 65  |djust all refere|
00002b80  6e 63 65 73 20 74 6f 20  73 79 73 74 65 6d 20 76  |nces to system v|
00002b90  61 72 69 61 62 6c 65 73  2e 3c 2f 50 3e 0a 0a 3c  |ariables.</P>..<|
00002ba0  50 3e 4f 6e 6c 79 20 73  6f 6d 65 20 6f 66 20 74  |P>Only some of t|
00002bb0  68 65 20 66 6f 6c 6c 6f  77 69 6e 67 20 76 61 72  |he following var|
00002bc0  69 61 62 6c 65 73 20 6d  61 79 20 62 65 20 73 65  |iables may be se|
00002bd0  74 2c 20 64 65 70 65 6e  64 69 6e 67 20 6f 6e 20  |t, depending on |
00002be0  74 68 65 20 6d 65 74 68  6f 64 20 74 68 65 20 63  |the method the c|
00002bf0  6c 69 65 6e 74 20 75 73  65 64 20 61 6e 64 20 74  |lient used and t|
00002c00  68 65 20 69 6e 66 6f 72  6d 61 74 69 6f 6e 20 69  |he information i|
00002c10  74 20 70 61 73 73 65 64  2e 3c 2f 50 3e 0a 0a 3c  |t passed.</P>..<|
00002c20  48 35 3e 53 74 61 74 69  63 20 56 61 72 69 61 62  |H5>Static Variab|
00002c30  6c 65 73 3c 2f 48 35 3e  0a 3c 49 3e 56 61 72 69  |les</H5>.<I>Vari|
00002c40  61 62 6c 65 73 20 77 68  69 63 68 20 61 72 65 20  |ables which are |
00002c50  63 6f 6e 73 74 61 6e 74  20 66 6f 72 20 74 68 65  |constant for the|
00002c60  20 64 75 72 61 74 69 6f  6e 20 6f 66 20 74 68 65  | duration of the|
00002c70  20 73 65 72 76 65 72 2e  3c 2f 49 3e 0a 3c 44 4c  | server.</I>.<DL|
00002c80  3e 0a 3c 44 54 3e 43 47  49 24 53 65 72 76 65 72  |>.<DT>CGI$Server|
00002c90  53 6f 66 74 77 61 72 65  0a 3c 44 44 3e 43 6f 6e  |Software.<DD>Con|
00002ca0  74 61 69 6e 73 20 74 68  65 20 6e 61 6d 65 20 61  |tains the name a|
00002cb0  6e 64 20 76 65 72 73 69  6f 6e 20 6f 66 20 74 68  |nd version of th|
00002cc0  65 20 73 65 72 76 65 72  20 73 6f 66 74 77 61 72  |e server softwar|
00002cd0  65 2c 20 65 2e 67 2e 20  27 4e 65 74 70 6c 65 78  |e, e.g. 'Netplex|
00002ce0  2f 30 2e 30 39 20 20 28  30 35 20 4f 63 74 20 31  |/0.09  (05 Oct 1|
00002cf0  39 39 36 29 27 2e 0a 3c  44 54 3e 43 47 49 24 53  |996)'..<DT>CGI$S|
00002d00  65 72 76 65 72 4e 61 6d  65 0a 3c 44 44 3e 49 73  |erverName.<DD>Is|
00002d10  20 74 68 65 20 66 75 6c  6c 79 20 71 75 61 6c 69  | the fully quali|
00002d20  66 69 65 64 20 6e 61 6d  65 20 6f 66 20 74 68 65  |fied name of the|
00002d30  20 73 65 72 76 65 72 2e  20 20 41 74 20 73 74 61  | server.  At sta|
00002d40  72 74 75 70 2c 20 4e 65  74 70 6c 65 78 20 77 69  |rtup, Netplex wi|
00002d50  6c 6c 20 61 74 74 65 6d  70 74 20 74 6f 20 72 65  |ll attempt to re|
00002d60  73 6f 6c 76 65 20 74 68  69 73 20 66 72 6f 6d 20  |solve this from |
00002d70  74 68 65 20 49 6e 65 74  24 4c 6f 63 61 6c 49 50  |the Inet$LocalIP|
00002d80  20 76 61 72 69 61 62 6c  65 2e 0a 3c 44 54 3e 43  | variable..<DT>C|
00002d90  47 49 24 47 61 74 65 77  61 79 49 6e 74 65 72 66  |GI$GatewayInterf|
00002da0  61 63 65 0a 3c 44 44 3e  41 6c 77 61 79 73 20 73  |ace.<DD>Always s|
00002db0  65 74 20 74 6f 20 22 47  47 49 2f 31 2e 31 22 2e  |et to "GGI/1.1".|
00002dc0  0a 3c 44 54 3e 43 47 49  24 53 65 72 76 65 72 50  |.<DT>CGI$ServerP|
00002dd0  6f 72 74 0a 3c 44 44 3e  53 65 74 20 74 6f 20 74  |ort.<DD>Set to t|
00002de0  68 65 20 70 6f 72 74 20  74 68 61 74 20 74 68 65  |he port that the|
00002df0  20 73 65 72 76 65 72 20  69 73 20 6f 70 65 72 61  | server is opera|
00002e00  74 69 6e 67 20 6f 6e 2e  0a 3c 2f 44 4c 3e 0a 0a  |ting on..</DL>..|
00002e10  3c 48 35 3e 44 79 6e 61  6d 69 63 20 56 61 72 69  |<H5>Dynamic Vari|
00002e20  61 62 6c 65 73 3c 2f 48  35 3e 0a 3c 49 3e 56 61  |ables</H5>.<I>Va|
00002e30  72 69 61 62 6c 65 73 20  77 68 69 63 68 20 63 68  |riables which ch|
00002e40  61 6e 67 65 20 61 63 63  6f 72 64 69 6e 67 20 74  |ange according t|
00002e50  6f 20 74 68 65 20 72 65  71 75 65 73 74 2e 3c 2f  |o the request.</|
00002e60  49 3e 0a 3c 44 4c 3e 0a  3c 44 54 3e 43 47 49 24  |I>.<DL>.<DT>CGI$|
00002e70  53 65 72 76 65 72 50 72  6f 74 6f 63 6f 6c 0a 3c  |ServerProtocol.<|
00002e80  44 44 3e 27 48 54 54 50  2f 31 2e 31 27 2c 20 27  |DD>'HTTP/1.1', '|
00002e90  48 54 54 50 2f 31 2e 30  27 20 6f 72 20 27 48 54  |HTTP/1.0' or 'HT|
00002ea0  54 50 2f 30 2e 39 27 20  64 65 70 65 6e 64 69 6e  |TP/0.9' dependin|
00002eb0  67 20 6f 6e 20 74 68 65  20 72 65 71 75 65 73 74  |g on the request|
00002ec0  20 72 65 63 65 69 76 65  64 2e 0a 3c 44 54 3e 43  | received..<DT>C|
00002ed0  47 49 24 52 65 71 75 65  73 74 4d 65 74 68 6f 64  |GI$RequestMethod|
00002ee0  0a 3c 44 44 3e 54 68 69  73 20 69 73 20 73 65 74  |.<DD>This is set|
00002ef0  20 74 6f 20 74 68 65 20  72 65 71 75 65 73 74 20  | to the request |
00002f00  6d 65 74 68 6f 64 20 74  68 61 74 20 77 61 73 20  |method that was |
00002f10  75 73 65 64 20 74 6f 20  72 65 74 72 69 65 76 65  |used to retrieve|
00002f20  20 74 68 65 20 66 69 6c  65 2c 20 65 2e 67 2e 20  | the file, e.g. |
00002f30  47 45 54 20 6f 72 20 50  4f 53 54 2e 0a 3c 44 54  |GET or POST..<DT|
00002f40  3e 43 47 49 24 50 61 74  68 49 6e 66 6f 0a 3c 44  |>CGI$PathInfo.<D|
00002f50  44 3e 49 66 20 79 6f 75  20 73 70 65 63 69 66 79  |D>If you specify|
00002f60  20 74 68 65 20 55 52 4c  20 68 74 74 70 3a 2f 2f  | the URL http://|
00002f70  6d 65 72 63 75 72 79 2e  6e 65 74 70 6c 65 78 2e  |mercury.netplex.|
00002f80  6e 65 74 2f 63 67 69 2d  62 69 6e 2f 69 6d 61 67  |net/cgi-bin/imag|
00002f90  65 6d 61 70 2f 64 74 68  6f 6d 61 73 20 74 68 65  |emap/dthomas the|
00002fa0  6e 20 69 66 20 74 68 65  20 70 72 6f 67 72 61 6d  |n if the program|
00002fb0  20 69 6d 61 67 65 6d 61  70 20 65 78 69 73 74 73  | imagemap exists|
00002fc0  20 69 6e 20 74 68 65 20  63 67 69 2d 62 69 6e 20  | in the cgi-bin |
00002fd0  64 69 72 65 63 74 6f 72  79 2c 20 50 61 74 68 49  |directory, PathI|
00002fe0  6e 66 6f 20 77 69 6c 6c  20 62 65 20 73 65 74 20  |nfo will be set |
00002ff0  74 6f 20 27 64 74 68 6f  6d 61 73 27 2e 0a 3c 44  |to 'dthomas'..<D|
00003000  54 3e 43 47 49 24 50 61  74 68 54 72 61 6e 73 6c  |T>CGI$PathTransl|
00003010  61 74 65 64 0a 3c 44 44  3e 54 68 69 73 20 69 73  |ated.<DD>This is|
00003020  20 74 68 65 20 73 61 6d  65 20 61 73 20 61 62 6f  | the same as abo|
00003030  76 65 20 62 75 74 20 69  73 20 70 72 65 66 69 78  |ve but is prefix|
00003040  65 64 20 77 69 74 68 20  74 68 65 20 70 61 74 68  |ed with the path|
00003050  20 6f 66 20 74 68 65 20  57 65 62 20 70 61 67 65  | of the Web page|
00003060  20 64 69 72 65 63 74 6f  72 79 2e 20 20 57 69 74  | directory.  Wit|
00003070  68 20 74 68 65 20 61 62  6f 76 65 20 65 78 61 6d  |h the above exam|
00003080  70 6c 65 20 69 74 20 77  6f 75 6c 64 20 62 65 20  |ple it would be |
00003090  73 6f 6d 65 74 68 69 6e  67 20 6c 69 6b 65 2c 20  |something like, |
000030a0  27 41 44 46 53 3a 3a 49  44 45 44 69 73 63 34 2e  |'ADFS::IDEDisc4.|
000030b0  24 2e 49 6e 74 65 72 6e  65 74 2e 57 57 57 2e 64  |$.Internet.WWW.d|
000030c0  74 68 6f 6d 61 73 27 2e  0a 3c 44 54 3e 43 47 49  |thomas'..<DT>CGI|
000030d0  24 53 63 72 69 70 74 46  69 6c 65 6e 61 6d 65 0a  |$ScriptFilename.|
000030e0  3c 44 44 3e 54 68 65 20  66 75 6c 6c 20 52 49 53  |<DD>The full RIS|
000030f0  43 20 4f 53 20 66 69 6c  65 6e 61 6d 65 20 6f 66  |C OS filename of|
00003100  20 74 68 65 20 70 72 6f  67 72 61 6d 2e 20 20 46  | the program.  F|
00003110  6f 72 20 65 78 61 6d 70  6c 65 20 27 41 44 46 53  |or example 'ADFS|
00003120  3a 3a 49 44 45 44 69 73  63 34 2e 24 2e 49 6e 74  |::IDEDisc4.$.Int|
00003130  65 72 6e 65 74 2e 57 57  57 2e 63 67 69 2d 62 69  |ernet.WWW.cgi-bi|
00003140  6e 2e 70 72 6f 63 65 73  73 27 2e 0a 3c 44 54 3e  |n.process'..<DT>|
00003150  43 47 49 24 53 63 72 69  70 74 4e 61 6d 65 0a 3c  |CGI$ScriptName.<|
00003160  44 44 3e 54 68 65 20 55  52 4c 20 70 61 74 68 20  |DD>The URL path |
00003170  6f 66 20 74 68 65 20 70  72 6f 67 72 61 6d 2e 20  |of the program. |
00003180  20 46 6f 72 20 65 78 61  6d 70 6c 65 20 27 2f 63  | For example '/c|
00003190  67 69 2d 62 69 6e 2f 70  72 6f 63 65 73 73 27 2e  |gi-bin/process'.|
000031a0  0a 3c 44 54 3e 43 47 49  24 51 75 65 72 79 53 74  |.<DT>CGI$QuerySt|
000031b0  72 69 6e 67 0a 3c 44 44  3e 54 68 65 20 64 61 74  |ring.<DD>The dat|
000031c0  61 20 70 61 73 73 65 64  20 69 6e 20 74 68 65 20  |a passed in the |
000031d0  55 52 4c 2c 20 77 68 69  63 68 20 66 6f 6c 6c 6f  |URL, which follo|
000031e0  77 65 64 20 74 68 65 20  27 3f 27 2e 20 20 55 73  |wed the '?'.  Us|
000031f0  65 64 20 62 79 20 47 45  54 20 72 65 71 75 65 73  |ed by GET reques|
00003200  74 73 20 74 6f 20 70 61  73 73 20 70 61 72 61 6d  |ts to pass param|
00003210  65 74 65 72 73 20 74 6f  20 43 47 49 20 70 72 6f  |eters to CGI pro|
00003220  67 72 61 6d 73 2e 0a 3c  44 54 3e 43 47 49 24 52  |grams..<DT>CGI$R|
00003230  65 6d 6f 74 65 48 6f 73  74 0a 3c 44 44 3e 54 68  |emoteHost.<DD>Th|
00003240  65 20 6e 61 6d 65 20 6f  66 20 74 68 65 20 63 6c  |e name of the cl|
00003250  69 65 6e 74 20 6d 61 63  68 69 6e 65 2c 20 6f 72  |ient machine, or|
00003260  20 74 68 65 20 64 6f 74  74 65 64 2d 49 50 20 61  | the dotted-IP a|
00003270  64 64 72 65 73 73 20 69  66 20 75 6e 6b 6e 6f 77  |ddress if unknow|
00003280  6e 2e 0a 3c 44 54 3e 43  47 49 24 52 65 6d 6f 74  |n..<DT>CGI$Remot|
00003290  65 41 64 64 72 0a 3c 44  44 3e 54 68 65 20 64 6f  |eAddr.<DD>The do|
000032a0  74 74 65 64 2d 49 50 20  61 64 64 72 65 73 73 20  |tted-IP address |
000032b0  6f 66 20 74 68 65 20 63  6c 69 65 6e 74 20 6d 61  |of the client ma|
000032c0  63 68 69 6e 65 2e 0a 3c  44 54 3e 43 47 49 24 41  |chine..<DT>CGI$A|
000032d0  75 74 68 54 79 70 65 0a  3c 44 44 3e 49 66 20 43  |uthType.<DD>If C|
000032e0  6c 69 65 6e 74 20 41 75  74 68 65 6e 74 69 63 61  |lient Authentica|
000032f0  74 69 6f 6e 20 69 73 20  69 6e 20 75 73 65 20 74  |tion is in use t|
00003300  68 65 6e 20 74 68 69 73  20 77 69 6c 6c 20 62 65  |hen this will be|
00003310  20 73 65 74 20 74 6f 20  27 42 61 73 69 63 27 2e  | set to 'Basic'.|
00003320  0a 3c 44 54 3e 43 47 49  24 41 75 74 68 55 73 65  |.<DT>CGI$AuthUse|
00003330  72 0a 3c 44 44 3e 49 66  20 43 6c 69 65 6e 74 20  |r.<DD>If Client |
00003340  41 75 74 68 65 6e 74 69  63 61 74 69 6f 6e 20 69  |Authentication i|
00003350  73 20 69 6e 20 75 73 65  20 74 68 65 6e 20 74 68  |s in use then th|
00003360  69 73 20 77 69 6c 6c 20  62 65 20 73 65 74 20 74  |is will be set t|
00003370  6f 20 74 68 65 20 75 73  65 72 6e 61 6d 65 20 6f  |o the username o|
00003380  66 20 74 68 65 20 63 6c  69 65 6e 74 20 27 6c 6f  |f the client 'lo|
00003390  67 67 65 64 20 69 6e 27  2e 0a 3c 44 54 3e 43 47  |gged in'..<DT>CG|
000033a0  49 24 43 6f 6e 74 65 6e  74 54 79 70 65 0a 3c 44  |I$ContentType.<D|
000033b0  44 3e 54 68 65 20 74 79  70 65 20 6f 66 20 64 61  |D>The type of da|
000033c0  74 61 20 74 68 61 74 20  68 61 73 20 62 65 65 6e  |ta that has been|
000033d0  20 73 75 62 6d 69 74 74  65 64 20 74 6f 20 74 68  | submitted to th|
000033e0  65 20 70 72 6f 67 72 61  6d 2e 20 28 41 70 70 6c  |e program. (Appl|
000033f0  69 65 73 20 74 6f 20 50  4f 53 54 20 6f 6e 6c 79  |ies to POST only|
00003400  29 2e 0a 3c 44 54 3e 43  47 49 24 43 6f 6e 74 65  |)..<DT>CGI$Conte|
00003410  6e 74 4c 65 6e 67 74 68  0a 3c 44 44 3e 54 68 65  |ntLength.<DD>The|
00003420  20 6c 65 6e 67 74 68 20  6f 66 20 74 68 65 20 64  | length of the d|
00003430  61 74 61 20 74 68 61 74  20 74 68 61 74 20 68 61  |ata that that ha|
00003440  73 20 62 65 65 6e 20 73  75 62 6d 69 74 74 65 64  |s been submitted|
00003450  20 74 6f 20 74 68 65 20  70 72 6f 67 72 61 6d 2e  | to the program.|
00003460  20 28 41 70 70 6c 69 65  73 20 74 6f 20 50 4f 53  | (Applies to POS|
00003470  54 20 6f 6e 6c 79 29 2e  0a 3c 44 54 3e 43 47 49  |T only)..<DT>CGI|
00003480  24 43 6f 6e 6e 65 63 74  69 6f 6e 4e 75 6d 62 65  |$ConnectionNumbe|
00003490  72 0a 3c 44 44 3e 54 68  65 20 63 75 72 72 65 6e  |r.<DD>The curren|
000034a0  74 20 69 6e 74 65 72 6e  61 6c 20 63 6f 6e 6e 65  |t internal conne|
000034b0  63 74 69 6f 6e 20 6e 75  6d 62 65 72 20 74 68 61  |ction number tha|
000034c0  74 20 74 68 65 20 70 72  6f 67 72 61 6d 20 69 73  |t the program is|
000034d0  20 6f 70 65 72 61 74 69  6e 67 20 61 73 2e 20 20  | operating as.  |
000034e0  55 73 65 64 20 66 6f 72  20 2e 2e 2e 0a 3c 44 54  |Used for ....<DT|
000034f0  3e 43 47 49 24 41 63 74  69 76 65 5f 3c 49 3e 6e  |>CGI$Active_<I>n|
00003500  3c 2f 49 3e 0a 3c 44 44  3e 54 68 69 73 20 69 73  |</I>.<DD>This is|
00003510  20 73 65 74 20 62 79 20  74 68 65 20 70 72 6f 67  | set by the prog|
00003520  72 61 6d 20 74 6f 20 69  6e 66 6f 72 6d 20 74 68  |ram to inform th|
00003530  65 20 73 65 72 76 65 72  20 74 68 61 74 20 74 68  |e server that th|
00003540  65 20 70 72 6f 67 72 61  6d 20 69 73 20 6d 75 6c  |e program is mul|
00003550  74 69 74 61 73 6b 69 6e  67 20 61 6e 64 20 77 69  |titasking and wi|
00003560  6c 6c 20 62 65 20 6d 61  6b 69 6e 67 20 63 61 6c  |ll be making cal|
00003570  6c 73 20 74 6f 20 57 69  6d 70 5f 50 6f 6c 6c 2e  |ls to Wimp_Poll.|
00003580  20 20 4f 6e 63 65 20 75  6e 73 65 74 2c 20 74 68  |  Once unset, th|
00003590  65 20 73 65 72 76 65 72  20 77 69 6c 6c 20 61 74  |e server will at|
000035a0  74 65 6d 70 74 20 74 6f  20 73 65 6e 64 20 74 68  |tempt to send th|
000035b0  65 20 70 72 6f 67 72 61  6d 27 73 20 6f 75 74 70  |e program's outp|
000035c0  75 74 20 74 6f 20 74 68  65 20 63 6c 69 65 6e 74  |ut to the client|
000035d0  2e 20 20 28 3c 49 3e 6e  3c 2f 49 3e 20 69 73 20  |.  (<I>n</I> is |
000035e0  61 6e 20 69 6e 74 65 72  6e 61 6c 20 63 6f 6e 6e  |an internal conn|
000035f0  65 63 74 69 6f 6e 20 6e  75 6d 62 65 72 29 2e 0a  |ection number)..|
00003600  3c 2f 44 4c 3e 0a 0a 3c  48 35 3e 48 54 54 50 20  |</DL>..<H5>HTTP |
00003610  48 65 61 64 65 72 20 46  69 65 6c 64 73 3c 2f 48  |Header Fields</H|
00003620  35 3e 0a 3c 49 3e 54 68  65 20 68 65 61 64 65 72  |5>.<I>The header|
00003630  20 66 69 65 6c 64 73 2c  20 61 73 20 73 75 62 6d  | fields, as subm|
00003640  69 74 74 65 64 20 62 79  20 74 68 65 20 63 6c 69  |itted by the cli|
00003650  65 6e 74 2e 3c 2f 49 3e  0a 3c 44 4c 3e 0a 3c 44  |ent.</I>.<DL>.<D|
00003660  44 3e 49 74 20 64 65 70  65 6e 64 73 20 65 6e 74  |D>It depends ent|
00003670  69 72 65 6c 79 20 6f 6e  20 74 68 65 20 63 6c 69  |irely on the cli|
00003680  65 6e 74 20 61 73 20 74  6f 20 77 68 61 74 20 79  |ent as to what y|
00003690  6f 75 20 77 69 6c 6c 20  66 69 6e 64 20 73 65 74  |ou will find set|
000036a0  20 69 6e 20 74 68 65 20  48 54 54 50 20 76 61 72  | in the HTTP var|
000036b0  69 61 62 6c 65 73 2e 0a  3c 2f 44 4c 3e 0a 0a 3c  |iables..</DL>..<|
000036c0  50 3e 54 68 65 72 65 20  69 73 20 61 6c 73 6f 20  |P>There is also |
000036d0  61 6e 6f 74 68 65 72 20  73 79 73 74 65 6d 20 76  |another system v|
000036e0  61 72 69 61 62 6c 65 2c  20 61 6c 74 68 6f 75 67  |ariable, althoug|
000036f0  68 20 6e 6f 74 20 73 74  72 69 63 74 6c 79 20 6c  |h not strictly l|
00003700  69 6e 6b 65 64 20 74 6f  20 43 47 49 20 70 72 6f  |inked to CGI pro|
00003710  67 72 61 6d 73 2c 20 77  68 69 63 68 20 69 73 20  |grams, which is |
00003720  75 73 65 66 75 6c 20 74  6f 20 68 61 76 65 2e 20  |useful to have. |
00003730  20 49 74 20 69 73 20 4e  65 74 70 6c 65 78 24 57  | It is Netplex$W|
00003740  65 62 50 61 67 65 73 44  69 72 20 77 68 69 63 68  |ebPagesDir which|
00003750  20 67 69 76 65 73 20 74  68 65 20 6e 61 6d 65 20  | gives the name |
00003760  6f 66 20 74 68 65 20 72  6f 6f 74 20 57 65 62 20  |of the root Web |
00003770  70 61 67 65 20 64 69 72  65 63 74 6f 72 79 2e 3c  |page directory.<|
00003780  2f 50 3e 0a 0a 0a 3c 48  33 3e 4e 6f 74 65 73 3c  |/P>...<H3>Notes<|
00003790  2f 48 33 3e 0a 3c 55 4c  3e 0a 3c 4c 49 3e 4e 65  |/H3>.<UL>.<LI>Ne|
000037a0  74 70 6c 65 78 20 63 68  65 63 6b 73 20 74 68 65  |tplex checks the|
000037b0  20 72 65 71 75 65 73 74  65 64 20 55 52 4c 20 66  | requested URL f|
000037c0  6f 72 20 27 2f 63 67 69  2d 62 69 6e 2f 27 20 61  |or '/cgi-bin/' a|
000037d0  6e 64 20 77 69 6c 6c 20  69 6e 76 6f 6b 65 20 74  |nd will invoke t|
000037e0  68 65 20 70 72 6f 67 72  61 6d 20 3c 42 3e 6f 6e  |he program <B>on|
000037f0  6c 79 3c 2f 42 3e 20 69  66 20 69 74 20 69 73 20  |ly</B> if it is |
00003800  69 6e 73 69 64 65 20 61  20 27 63 67 69 2d 62 69  |inside a 'cgi-bi|
00003810  6e 27 20 64 69 72 65 63  74 6f 72 79 20 3c 42 3e  |n' directory <B>|
00003820  61 6e 64 3c 2f 42 3e 20  69 73 20 6f 66 20 74 79  |and</B> is of ty|
00003830  70 65 20 43 6f 6d 6d 61  6e 64 2c 20 55 74 69 6c  |pe Command, Util|
00003840  69 74 79 2c 20 42 41 53  49 43 2c 20 41 62 73 6f  |ity, BASIC, Abso|
00003850  6c 75 74 65 2c 20 4f 62  65 79 20 6f 72 20 50 65  |lute, Obey or Pe|
00003860  72 6c 2c 20 6f 74 68 65  72 77 69 73 65 20 69 74  |rl, otherwise it|
00003870  20 77 69 6c 6c 20 62 65  20 73 65 72 76 65 64 20  | will be served |
00003880  61 73 20 61 20 66 69 6c  65 2e 0a 3c 4c 49 3e 43  |as a file..<LI>C|
00003890  47 49 20 64 69 72 65 63  74 6f 72 69 65 73 20 64  |GI directories d|
000038a0  6f 20 6e 6f 74 20 6e 65  65 64 20 74 6f 20 62 65  |o not need to be|
000038b0  20 69 6e 20 74 68 65 20  72 6f 6f 74 20 57 65 62  | in the root Web|
000038c0  20 70 61 67 65 20 64 69  72 65 63 74 6f 72 79 2c  | page directory,|
000038d0  20 65 2e 67 2e 20 79 6f  75 20 63 6f 75 6c 64 20  | e.g. you could |
000038e0  68 61 76 65 20 68 74 74  70 3a 2f 2f 69 72 6f 6e  |have http://iron|
000038f0  2e 6e 65 74 70 6c 65 78  2e 6e 65 74 2f 75 73 65  |.netplex.net/use|
00003900  72 73 2f 63 67 69 2d 62  69 6e 2f 20 77 68 69 63  |rs/cgi-bin/ whic|
00003910  68 20 77 6f 75 6c 64 20  73 74 69 6c 6c 20 77 6f  |h would still wo|
00003920  72 6b 20 4f 4b 2e 20 20  59 6f 75 20 63 61 6e 20  |rk OK.  You can |
00003930  68 61 76 65 20 6d 75 6c  74 69 70 6c 65 20 63 67  |have multiple cg|
00003940  69 2d 62 69 6e 20 64 69  72 65 63 74 6f 72 69 65  |i-bin directorie|
00003950  73 20 69 66 20 79 6f 75  20 77 61 6e 74 2e 0a 3c  |s if you want..<|
00003960  4c 49 3e 49 6e 20 6f 72  64 65 72 20 66 6f 72 20  |LI>In order for |
00003970  43 47 49 24 50 61 74 68  49 6e 66 6f 20 74 6f 20  |CGI$PathInfo to |
00003980  62 65 20 63 6f 72 72 65  63 74 2c 20 79 6f 75 20  |be correct, you |
00003990  3c 42 3e 6d 75 73 74 20  6e 6f 74 3c 2f 42 3e 20  |<B>must not</B> |
000039a0  75 73 65 20 73 75 62 64  69 72 65 63 74 6f 72 69  |use subdirectori|
000039b0  65 73 20 77 69 74 68 69  6e 20 74 68 65 20 63 67  |es within the cg|
000039c0  69 2d 62 69 6e 20 64 69  72 65 63 74 6f 72 69 65  |i-bin directorie|
000039d0  73 2e 0a 3c 4c 49 3e 54  68 65 20 66 69 72 73 74  |s..<LI>The first|
000039e0  20 6c 69 6e 65 20 6f 66  20 43 47 49 20 6f 75 74  | line of CGI out|
000039f0  70 75 74 20 69 73 20 70  61 72 73 65 64 2c 20 69  |put is parsed, i|
00003a00  66 20 69 74 20 62 65 67  69 6e 73 20 27 48 54 54  |f it begins 'HTT|
00003a10  50 2f 31 27 20 74 68 65  6e 20 69 74 20 69 73 20  |P/1' then it is |
00003a20  61 73 73 75 6d 65 64 20  74 68 61 74 20 74 68 65  |assumed that the|
00003a30  20 43 47 49 20 70 72 6f  67 72 61 6d 20 68 61 73  | CGI program has|
00003a40  20 67 65 6e 65 72 61 74  65 64 20 74 68 65 20 65  | generated the e|
00003a50  6e 74 69 72 65 20 68 65  61 64 65 72 20 69 74 73  |ntire header its|
00003a60  65 6c 66 20 61 6e 64 20  4e 65 74 70 6c 65 78 20  |elf and Netplex |
00003a70  77 69 6c 6c 20 6e 6f 74  20 61 74 74 61 63 68 20  |will not attach |
00003a80  61 6e 79 20 68 65 61 64  65 72 20 66 69 65 6c 64  |any header field|
00003a90  73 20 6f 66 20 69 74 73  20 6f 77 6e 2e 0a 3c 4c  |s of its own..<L|
00003aa0  49 3e 50 65 72 6c 20 69  73 20 73 75 70 70 6f 72  |I>Perl is suppor|
00003ab0  74 65 64 2c 20 61 73 20  6c 6f 6e 67 20 61 73 20  |ted, as long as |
00003ac0  69 74 20 69 73 20 3c 42  3e 6e 6f 74 3c 2f 42 3e  |it is <B>not</B>|
00003ad0  20 73 65 74 20 75 70 20  74 6f 20 72 75 6e 20 69  | set up to run i|
00003ae0  6e 20 61 20 54 61 73 6b  57 69 6e 64 6f 77 2e 20  |n a TaskWindow. |
00003af0  20 50 65 72 6c 20 66 69  6c 65 73 20 61 72 65 20  | Perl files are |
00003b00  64 65 74 65 63 74 65 64  20 62 79 20 74 68 65 20  |detected by the |
00003b10  66 69 6c 65 20 68 61 76  69 6e 67 20 61 20 66 69  |file having a fi|
00003b20  6c 65 74 79 70 65 20 6f  66 20 26 61 6d 70 3b 31  |letype of &amp;1|
00003b30  30 32 2e 0a 3c 4c 49 3e  41 62 73 6f 6c 75 74 65  |02..<LI>Absolute|
00003b40  20 66 69 6c 65 73 20 28  66 69 6c 65 74 79 70 65  | files (filetype|
00003b50  20 26 61 6d 70 3b 46 46  38 29 20 61 72 65 20 63  | &amp;FF8) are c|
00003b60  68 65 63 6b 65 64 20 74  6f 20 73 65 65 20 69 66  |hecked to see if|
00003b70  20 74 68 65 79 20 68 61  76 65 20 61 6e 20 41 50  | they have an AP|
00003b80  43 53 2d 6c 69 6b 65 20  68 65 61 64 65 72 2c 20  |CS-like header, |
00003b90  69 66 20 74 68 65 79 20  64 6f 20 74 68 65 6e 20  |if they do then |
00003ba0  74 68 65 79 20 61 72 65  20 69 6e 76 6f 6b 65 64  |they are invoked|
00003bb0  20 75 73 69 6e 67 20 55  6e 69 78 2d 6c 69 6b 65  | using Unix-like|
00003bc0  20 72 65 64 69 72 65 63  74 69 6f 6e 20 6f 70 65  | redirection ope|
00003bd0  72 61 74 6f 72 73 2e 0a  3c 4c 49 3e 49 6e 20 61  |rators..<LI>In a|
00003be0  20 6d 75 6c 74 69 74 61  73 6b 69 6e 67 20 70 72  | multitasking pr|
00003bf0  6f 67 72 61 6d 2c 20 74  68 65 20 43 47 49 20 73  |ogram, the CGI s|
00003c00  79 73 74 65 6d 20 76 61  72 69 61 62 6c 65 73 20  |ystem variables |
00003c10  61 72 65 20 6f 6e 6c 79  20 67 75 61 72 61 6e 74  |are only guarant|
00003c20  65 65 64 20 74 6f 20 62  65 20 70 72 65 73 65 6e  |eed to be presen|
00003c30  74 2c 20 61 6e 64 20 76  61 6c 69 64 2c 20 75 70  |t, and valid, up|
00003c40  20 75 6e 74 69 6c 20 74  68 65 20 66 69 72 73 74  | until the first|
00003c50  20 74 69 6d 65 20 79 6f  75 20 63 61 6c 6c 20 57  | time you call W|
00003c60  69 6d 70 5f 50 6f 6c 6c  2e 20 20 54 68 69 73 20  |imp_Poll.  This |
00003c70  69 73 20 62 65 63 61 75  73 65 20 6f 74 68 65 72  |is because other|
00003c80  20 6d 75 6c 74 69 74 61  73 6b 69 6e 67 20 70 72  | multitasking pr|
00003c90  6f 67 72 61 6d 73 20 6d  61 79 20 67 65 74 20 73  |ograms may get s|
00003ca0  74 61 72 74 65 64 20 77  68 65 6e 20 79 6f 75 20  |tarted when you |
00003cb0  72 65 6c 65 61 73 65 20  63 6f 6e 74 72 6f 6c 20  |release control |
00003cc0  74 6f 20 57 69 6d 70 5f  50 6f 6c 6c 2e 0a 3c 2f  |to Wimp_Poll..</|
00003cd0  55 4c 3e 0a 0a 3c 48 52  20 57 49 44 54 48 3d 22  |UL>..<HR WIDTH="|
00003ce0  35 30 25 22 3e 0a 0a 3c  41 20 4e 41 4d 45 3d 22  |50%">..<A NAME="|
00003cf0  65 78 61 6d 70 6c 65 73  22 3e 3c 48 32 3e 45 78  |examples"><H2>Ex|
00003d00  61 6d 70 6c 65 73 3c 2f  48 32 3e 3c 2f 41 3e 0a  |amples</H2></A>.|
00003d10  0a 3c 50 3e 54 68 65 73  65 20 70 72 6f 67 72 61  |.<P>These progra|
00003d20  6d 73 20 77 69 6c 6c 20  6e 6f 74 20 77 6f 72 6b  |ms will not work|
00003d30  20 69 66 20 79 6f 75 27  72 65 20 72 65 61 64 69  | if you're readi|
00003d40  6e 67 20 74 68 65 20 68  65 6c 70 20 66 69 6c 65  |ng the help file|
00003d50  73 20 64 69 72 65 63 74  6c 79 2e 3c 2f 50 3e 0a  |s directly.</P>.|
00003d60  0a 3c 50 3e 3c 44 4c 3e  0a 3c 44 54 3e 3c 42 3e  |.<P><DL>.<DT><B>|
00003d70  3c 41 20 48 52 45 46 3d  22 63 67 69 2d 62 69 6e  |<A HREF="cgi-bin|
00003d80  2f 74 69 6d 65 22 3e 54  69 6d 65 3c 2f 41 3e 3c  |/time">Time</A><|
00003d90  2f 42 3e 0a 3c 44 44 3e  41 20 43 47 49 20 70 72  |/B>.<DD>A CGI pr|
00003da0  6f 67 72 61 6d 20 77 68  69 63 68 20 77 68 65 6e  |ogram which when|
00003db0  20 72 65 74 72 69 65 76  65 64 20 64 69 73 70 6c  | retrieved displ|
00003dc0  61 79 73 20 74 68 65 20  74 69 6d 65 2e 0a 3c 44  |ays the time..<D|
00003dd0  54 3e 3c 42 3e 3c 41 20  48 52 45 46 3d 22 63 67  |T><B><A HREF="cg|
00003de0  69 2d 62 69 6e 2f 74 69  6d 65 6f 62 65 79 22 3e  |i-bin/timeobey">|
00003df0  54 69 6d 65 4f 62 65 79  3c 2f 41 3e 3c 2f 42 3e  |TimeObey</A></B>|
00003e00  0a 3c 44 44 3e 54 68 65  20 73 61 6d 65 20 61 73  |.<DD>The same as|
00003e10  20 61 62 6f 76 65 2c 20  62 75 74 20 69 6d 70 6c  | above, but impl|
00003e20  65 6d 65 6e 74 65 64 20  61 73 20 61 6e 20 4f 62  |emented as an Ob|
00003e30  65 79 20 73 63 72 69 70  74 2e 0a 3c 44 54 3e 3c  |ey script..<DT><|
00003e40  42 3e 3c 41 20 48 52 45  46 3d 22 63 67 69 2d 62  |B><A HREF="cgi-b|
00003e50  69 6e 2f 71 75 65 72 79  3f 54 68 69 73 2b 69 73  |in/query?This+is|
00003e60  2b 74 68 65 2b 71 75 65  72 79 2b 65 78 61 6d 70  |+the+query+examp|
00003e70  6c 65 22 3e 51 75 65 72  79 3c 2f 41 3e 3c 2f 42  |le">Query</A></B|
00003e80  3e 0a 3c 44 44 3e 41 20  43 47 49 20 70 72 6f 67  |>.<DD>A CGI prog|
00003e90  72 61 6d 20 77 68 69 63  68 20 77 68 65 6e 20 72  |ram which when r|
00003ea0  65 74 72 69 65 76 65 64  20 64 69 73 70 6c 61 79  |etrieved display|
00003eb0  73 20 74 68 65 20 71 75  65 72 79 20 73 74 72 69  |s the query stri|
00003ec0  6e 67 20 74 68 61 74 20  77 61 73 20 70 61 73 73  |ng that was pass|
00003ed0  65 64 20 74 6f 20 74 68  65 20 70 72 6f 67 72 61  |ed to the progra|
00003ee0  6d 2e 20 20 49 6e 20 74  68 69 73 20 63 61 73 65  |m.  In this case|
00003ef0  20 74 68 65 20 71 75 65  72 79 20 73 74 72 69 6e  | the query strin|
00003f00  67 20 69 73 20 27 54 68  69 73 2b 69 73 2b 74 68  |g is 'This+is+th|
00003f10  65 2b 71 75 65 72 79 2b  65 78 61 6d 70 6c 65 27  |e+query+example'|
00003f20  2e 0a 3c 44 54 3e 3c 42  3e 3c 41 20 48 52 45 46  |..<DT><B><A HREF|
00003f30  3d 22 66 6f 72 6d 22 3e  46 6f 72 6d 3c 2f 41 3e  |="form">Form</A>|
00003f40  3c 2f 42 3e 0a 3c 44 44  3e 41 6e 20 48 54 4d 4c  |</B>.<DD>An HTML|
00003f50  20 70 61 67 65 20 63 6f  6e 74 61 69 6e 69 6e 67  | page containing|
00003f60  20 61 20 46 6f 72 6d 20  77 68 69 63 68 20 77 68  | a Form which wh|
00003f70  65 6e 20 73 75 62 6d 69  74 74 65 64 20 69 73 20  |en submitted is |
00003f80  73 65 6e 74 20 74 6f 20  61 20 43 47 49 20 70 72  |sent to a CGI pr|
00003f90  6f 67 72 61 6d 20 63 61  6c 6c 65 64 20 27 66 6f  |ogram called 'fo|
00003fa0  72 6d 27 20 77 68 69 63  68 20 64 69 73 70 6c 61  |rm' which displa|
00003fb0  79 73 20 74 68 65 20 72  65 73 75 6c 74 73 2e 20  |ys the results. |
00003fc0  20 54 68 69 73 20 75 73  65 73 20 74 68 65 20 50  | This uses the P|
00003fd0  4f 53 54 20 6d 65 74 68  6f 64 20 72 61 74 68 65  |OST method rathe|
00003fe0  72 20 74 68 61 6e 20 47  45 54 2e 0a 3c 44 54 3e  |r than GET..<DT>|
00003ff0  3c 42 3e 3c 41 20 48 52  45 46 3d 22 63 67 69 2d  |<B><A HREF="cgi-|
00004000  62 69 6e 2f 74 61 73 6b  73 22 3e 54 61 73 6b 73  |bin/tasks">Tasks|
00004010  3c 2f 41 3e 3c 2f 42 3e  0a 3c 44 44 3e 44 79 6e  |</A></B>.<DD>Dyn|
00004020  61 6d 69 63 61 6c 6c 79  20 62 75 69 6c 64 73 20  |amically builds |
00004030  61 6e 20 48 54 4d 4c 20  70 61 67 65 20 6f 66 20  |an HTML page of |
00004040  69 6e 66 6f 72 6d 61 74  69 6f 6e 20 61 62 6f 75  |information abou|
00004050  74 20 61 6c 6c 20 72 75  6e 6e 69 6e 67 20 74 61  |t all running ta|
00004060  73 6b 73 20 6f 6e 20 79  6f 75 72 20 6d 61 63 68  |sks on your mach|
00004070  69 6e 65 2e 0a 3c 44 54  3e 3c 42 3e 3c 41 20 48  |ine..<DT><B><A H|
00004080  52 45 46 3d 22 63 67 69  2d 62 69 6e 2f 69 6e 66  |REF="cgi-bin/inf|
00004090  6f 22 3e 49 6e 66 6f 3c  2f 41 3e 3c 2f 42 3e 0a  |o">Info</A></B>.|
000040a0  3c 44 44 3e 50 72 6f 76  69 64 65 73 20 69 6e 66  |<DD>Provides inf|
000040b0  6f 72 6d 61 74 69 6f 6e  20 6f 6e 20 74 68 65 20  |ormation on the |
000040c0  73 79 73 74 65 6d 20 76  61 72 69 61 62 6c 65 73  |system variables|
000040d0  20 75 73 65 64 20 62 79  20 4e 65 74 70 6c 65 78  | used by Netplex|
000040e0  20 74 6f 20 69 6e 66 6f  72 6d 20 43 47 49 20 70  | to inform CGI p|
000040f0  72 6f 67 72 61 6d 73 20  6f 66 20 74 68 65 69 72  |rograms of their|
00004100  20 70 61 72 61 6d 65 74  65 72 73 2e 0a 3c 44 54  | parameters..<DT|
00004110  3e 3c 42 3e 3c 41 20 48  52 45 46 3d 22 63 67 69  |><B><A HREF="cgi|
00004120  2d 62 69 6e 2f 64 69 72  22 3e 44 69 72 3c 2f 41  |-bin/dir">Dir</A|
00004130  3e 3c 2f 42 3e 0a 3c 44  44 3e 41 6e 20 61 64 76  |></B>.<DD>An adv|
00004140  61 6e 63 65 64 20 76 65  72 73 69 6f 6e 20 6f 66  |anced version of|
00004150  20 74 68 65 20 51 75 65  72 79 20 70 72 6f 67 72  | the Query progr|
00004160  61 6d 20 77 68 69 63 68  20 75 73 65 73 20 73 65  |am which uses se|
00004170  6c 66 2d 72 65 66 65 72  65 6e 63 65 73 20 74 6f  |lf-references to|
00004180  20 65 6e 61 62 6c 65 20  74 68 65 20 75 73 65 72  | enable the user|
00004190  20 74 6f 20 74 72 61 76  65 72 73 65 20 61 20 64  | to traverse a d|
000041a0  69 72 65 63 74 6f 72 79  20 73 74 72 75 63 74 75  |irectory structu|
000041b0  72 65 20 61 6e 64 20 73  65 72 76 65 20 66 69 6c  |re and serve fil|
000041c0  65 73 2e 20 20 49 74 20  64 65 66 61 75 6c 74 73  |es.  It defaults|
000041d0  20 74 6f 20 75 73 69 6e  67 20 27 41 44 46 53 3a  | to using 'ADFS:|
000041e0  3a 34 2e 24 27 2c 20 77  68 69 63 68 20 6d 61 79  |:4.$', which may|
000041f0  20 6e 6f 74 20 62 65 20  61 70 70 6c 69 63 61 62  | not be applicab|
00004200  6c 65 20 74 6f 20 79 6f  75 72 20 73 79 73 74 65  |le to your syste|
00004210  6d 2e 20 20 49 74 20 77  69 6c 6c 20 6f 6e 6c 79  |m.  It will only|
00004220  20 6c 69 73 74 20 50 75  62 6c 69 63 2d 72 65 61  | list Public-rea|
00004230  64 61 62 6c 65 20 66 69  6c 65 73 2e 0a 3c 42 52  |dable files..<BR|
00004240  3e 28 4e 6f 74 65 3a 20  41 72 63 57 65 62 20 66  |>(Note: ArcWeb f|
00004250  6f 75 6c 73 20 75 70 20  77 69 74 68 20 74 68 69  |ouls up with thi|
00004260  73 20 70 72 6f 67 72 61  6d 20 64 75 65 20 74 6f  |s program due to|
00004270  20 69 74 73 20 6f 76 65  72 2d 7a 65 61 6c 6f 75  | its over-zealou|
00004280  73 20 55 52 4c 20 76 65  72 69 66 79 69 6e 67 29  |s URL verifying)|
00004290  2e 0a 3c 44 54 3e 3c 42  3e 3c 41 20 48 52 45 46  |..<DT><B><A HREF|
000042a0  3d 22 63 67 69 2d 62 69  6e 2f 76 65 6c 6f 63 69  |="cgi-bin/veloci|
000042b0  74 79 22 3e 56 65 6c 6f  63 69 74 79 3c 2f 41 3e  |ty">Velocity</A>|
000042c0  3c 2f 42 3e 0a 3c 44 44  3e 41 6e 20 65 78 61 6d  |</B>.<DD>An exam|
000042d0  70 6c 65 20 6f 66 20 61  20 3c 42 3e 6d 75 6c 74  |ple of a <B>mult|
000042e0  69 74 61 73 6b 69 6e 67  3c 2f 42 3e 20 43 47 49  |itasking</B> CGI|
000042f0  20 70 72 6f 67 72 61 6d  2e 20 20 4d 6f 6e 69 74  | program.  Monit|
00004300  6f 72 73 20 74 68 65 20  64 65 73 6b 74 6f 70 20  |ors the desktop |
00004310  66 6f 72 20 66 69 76 65  20 73 65 63 6f 6e 64 73  |for five seconds|
00004320  20 61 6e 64 20 74 68 65  6e 20 72 65 74 75 72 6e  | and then return|
00004330  73 20 61 6e 20 66 69 67  75 72 65 20 69 6e 64 69  |s an figure indi|
00004340  63 61 74 69 6e 67 20 68  6f 77 20 66 61 73 74 20  |cating how fast |
00004350  74 68 65 20 64 65 73 6b  74 6f 70 20 69 73 20 6f  |the desktop is o|
00004360  70 65 72 61 74 69 6e 67  20 28 69 6e 20 70 6f 6c  |perating (in pol|
00004370  6c 73 20 70 65 72 20 73  65 63 6f 6e 64 29 2e 0a  |ls per second)..|
00004380  3c 2f 44 4c 3e 3c 2f 50  3e 0a 0a 3c 50 3e 3c 42  |</DL></P>..<P><B|
00004390  3e 4e 6f 74 65 20 3a 3c  2f 42 3e 20 54 68 65 73  |>Note :</B> Thes|
000043a0  65 20 70 72 6f 67 72 61  6d 73 20 61 72 65 20 70  |e programs are p|
000043b0  72 6f 76 69 64 65 64 20  70 75 72 65 6c 79 20 66  |rovided purely f|
000043c0  6f 72 20 64 65 6d 6f 6e  73 74 72 61 74 69 6f 6e  |or demonstration|
000043d0  20 70 75 72 70 6f 73 65  73 2e 20 20 59 6f 75 20  | purposes.  You |
000043e0  73 68 6f 75 6c 64 20 6e  6f 74 20 61 6c 6c 6f 77  |should not allow|
000043f0  20 6f 70 65 6e 20 61 63  63 65 73 73 20 74 6f 20  | open access to |
00004400  79 6f 75 72 20 6d 61 63  68 69 6e 65 20 77 69 74  |your machine wit|
00004410  68 20 74 68 65 73 65 20  70 72 6f 67 72 61 6d 73  |h these programs|
00004420  20 70 72 65 73 65 6e 74  20 2d 20 70 61 72 74 69  | present - parti|
00004430  63 75 6c 61 72 6c 79 20  44 69 72 20 61 73 20 69  |cularly Dir as i|
00004440  74 20 61 6c 6c 6f 77 73  20 75 6e 72 65 73 74 72  |t allows unrestr|
00004450  69 63 74 65 64 20 61 63  63 65 73 73 20 74 6f 20  |icted access to |
00004460  61 6e 79 20 66 69 6c 69  6e 67 20 73 79 73 74 65  |any filing syste|
00004470  6d 20 6f 6e 20 79 6f 75  72 20 6d 61 63 68 69 6e  |m on your machin|
00004480  65 2e 3c 2f 50 3e 0a 0a  3c 48 52 3e 0a 0a 3c 50  |e.</P>..<HR>..<P|
00004490  3e 3c 43 45 4e 54 45 52  3e 0a 3c 41 20 48 52 45  |><CENTER>.<A HRE|
000044a0  46 3d 22 31 32 2d 61 75  74 68 22 3e 3c 49 4d 47  |F="12-auth"><IMG|
000044b0  20 53 52 43 3d 22 69 6d  61 67 65 73 2f 62 75 74  | SRC="images/but|
000044c0  74 6f 6e 73 2f 62 61 6b  22 20 57 49 44 54 48 3d  |tons/bak" WIDTH=|
000044d0  33 32 20 48 45 49 47 48  54 3d 33 32 20 42 4f 52  |32 HEIGHT=32 BOR|
000044e0  44 45 52 3d 30 20 41 4c  54 3d 22 5b 20 50 72 65  |DER=0 ALT="[ Pre|
000044f0  76 69 6f 75 73 20 5d 22  3e 3c 2f 41 3e 0a 3c 41  |vious ]"></A>.<A|
00004500  20 48 52 45 46 3d 22 69  6e 64 65 78 22 3e 3c 49  | HREF="index"><I|
00004510  4d 47 20 53 52 43 3d 22  69 6d 61 67 65 73 2f 62  |MG SRC="images/b|
00004520  75 74 74 6f 6e 73 2f 75  70 22 20 57 49 44 54 48  |uttons/up" WIDTH|
00004530  3d 33 32 20 48 45 49 47  48 54 3d 33 32 20 42 4f  |=32 HEIGHT=32 BO|
00004540  52 44 45 52 3d 30 20 41  4c 54 3d 22 5b 20 49 6e  |RDER=0 ALT="[ In|
00004550  64 65 78 20 5d 22 3e 3c  2f 41 3e 0a 3c 41 20 48  |dex ]"></A>.<A H|
00004560  52 45 46 3d 22 31 34 2d  69 6d 61 67 65 22 3e 3c  |REF="14-image"><|
00004570  49 4d 47 20 53 52 43 3d  22 69 6d 61 67 65 73 2f  |IMG SRC="images/|
00004580  62 75 74 74 6f 6e 73 2f  66 77 64 22 20 57 49 44  |buttons/fwd" WID|
00004590  54 48 3d 33 32 20 48 45  49 47 48 54 3d 33 32 20  |TH=32 HEIGHT=32 |
000045a0  42 4f 52 44 45 52 3d 30  20 41 4c 54 3d 22 5b 20  |BORDER=0 ALT="[ |
000045b0  4e 65 78 74 20 5d 22 3e  3c 2f 41 3e 0a 3c 2f 43  |Next ]"></A>.</C|
000045c0  45 4e 54 45 52 3e 3c 2f  50 3e 0a 0a 3c 2f 42 4f  |ENTER></P>..</BO|
000045d0  44 59 3e 0a 0a 3c 2f 48  54 4d 4c 3e 0a           |DY>..</HTML>.|
000045dd