The DragonFly Server CGI 1.40 implementation is not based on standard Web Server CGI protocols. The reasons for this follow. If this is an issue with your installation, a standard version of CGI interfaces can be supplied.
.. The DragonFly CGI interface uses memory pointers. Memory pointers are an incredibly fast way to move data between programs. STDIN, STDOUT and non compiled scripts do not make the grade for Enterprise data manipulation because they are inefficient and slow. To maintain a sense of familiarity, the variables in your program may be referred to as STDIN and STDOUT.
In future releases if there is sufficient demand, Java and Rexx scripts may be incorporated into the server CGI interface. In the meantime, no CGI functional capability is being sacrificed. Java and rexx are of course already available client side.
The CGI program will be passed a pointer on which a structure is based.
The structure contains the following variables.
|STDIN LENGTH||4 byte binary length field|
|STDIN||currently 32696 bytes|
|STDOUT LENGTH||4 byte binary length field|
|STDOUT||currently 32696 bytes|
|RC||4 byte binary return code for error tracking|
|MIME||for describing the data type sent to the browser|
(there are special notes for COBOL which does not support pointers)
The CGI programs can access files in the usual manner. They must build their own HTML and may optionally build the http header. The MIME variable in addition to standard MIME types can contain the keyword ASIS to allow the programmer to completely control the Web Server output. The RC is set to 1 upon calling the CGI program. If the CGI program is successful it should change the RC to 0 and if unsuccessful to whatever error code it would like the server to display on the browser in plain text. Output from the CGI programs is sent via the DragonFly server to the client making the request.
CGI program names must be of the format CGIPGM1, CGIPGM2...CGIPGM4 or for COBOL, CGIPGMA,CGIPGMB...CGIPGME. are recognized and properly executed by the Dragonfly Server.
If you set the MIME variable to "ASIS" then the DragonFly Server will send all output exactly as the CGIPGM has written it to the client. Otherwise, the Dragofly Server will send a default header back (text/html file type) with any data returned from the script. Important: If you do not choose to write the entire HTTP header, you should not provide any special headers, as they will appear as part of the body after Dragonfly Server processing.
If you begin your script with any of the following:
the DragonFly Server will append the appropriate HTTP response status (200 or 302) followed by the headers and content of your script exactly as received.
For example, to send back HTML to the client, your output should read:
Content-type: text/html <HTML><HEAD> <TITLE>output of HTML from CGI PGM</TITLE> </HEAD><BODY> <H1>Sample output</H1> etc, etc, etc. </BODY></HTML>
In the above example, the response prefix is: HTTP/1.0 200 OK
To reference a file on another HTTP server, you would output something like this:
Location: http://www.tysonsystems.com/ Content-type: text/html <HTML><HEAD> <TITLE>Whoops...it moved</TITLE> </HEAD><BODY> <H1>Content Moved!</H1> </BODY></HTML>
In the above example, the response prefixed is: HTTP/1.0 302 MOVED Important: The Location: directive comes prior to the Content-type: directive.