Introduction
  CGI and SSI
    CGI
    <!--#exec-->
  <pike> tag
  Pike script
  Modules
  Parser modules
  Location modules
  Other module types
  Request information object
  Responses
  Library methods
 
CGI

A CGI script is a program or script that is executed once for each request for it. The CGI script is either identified by file extension, for example .cgi, or by residing in a certain directory, for example cgi-bin/. A request to a CGI script will be handled by finding the script and starting it with information about the request sent as environment variables and on stdin. The script returns data by writing it to stdout.

The CGI script needs to be an executable file on the operating system. On Unix this is either a program, or a script that begins with #! followed by the name of the interpreter. On Windows this is either a program or a file with an extension bound to the suitable interpreter.

Environment Variables
When invoking CGI scripts Challenger passes a number of environment variables to the script.

AUTH_TYPE
contains the authentication type in use. The most common value is "Basic".
COOKIES
lists all cookie names associated with this request.

COOKIE_name
contains the value of the cookie name.

DOCUMENT_NAME
contains the name of the CGI script.

DOCUMENT_URI
contains the path part or the URL to the CGI script.

GATEWAY_INTERFACE
contains the version of the CGI protocol used, which will be CGI/1.1 for the 1.3 version of Challenger.

HTTP_ACCEPT
contains the contents of the accept header of HTTP.

HTTP_ACCEPT_CHARSET
contains the contents of the accept-charset header of HTTP.

HTTP_ACCEPT_ENCODING
contains the contents of the accept-encoding header of HTTP.

HTTP_ACCEPT_LANGUAGE
contains the contents of the accept-language header of HTTP.

HTTP_AUTHORIZATION
contains the contents of the auth header of HTTP. It will only be available of the Raw user info variable has been set to Yes.

HTTP_USER_AGENT
contains the name of the browser used.

INDEX
contains the query part of the URL.

QUERY_STRING
contains the query part of the URL.

QUERY_name
contains the value of the form variable name.

REMOTE_ADDR
contains the IP number of the client machine.

REMOTE_HOST
contains the domain name of the client machine, if Challenger has had time to find it. Since it takes some time to find what domain name a computer has this information will not be available the first time a certain computer connects to the server.

REMOTE_PORT
contains the port number used by the client.

REMOTE_USER
the login name used by the user.

REMOTE_PASSWORD
the password used by the user, only available if the Send decoded password variable is set to Yes.

REQUEST_METHOD
contains the method given in the HTTP request. In most cases, this will probably be GET or POST, but other HTTP methods, like PUT, are also possible. When using special protocols, such as WebDAV, other request methods may also occur.

SCRIPT_FILENAME
contains the complete path in the file system to the CGI script.

SCRIPT_NAME
contains the path part in the URL.

SERVER_NAME
contains the domain name of the web server.

SERVER_PORT
contains the port number of the web servers. The default is 80 for HTTP or 443 for HTTPS, but it can be almost any value. If the server has seveal ports this variable will contain the port used to access the script.

SERVER_PROTOCOL
contains the protocol used.

SERVER_SOFTWARE
contains the version information of the web server.

SERVER_URL
contains the URL to the web server. Together with SCRIPT_NAME, this makes up the URL for the script.

SUPPORTS
contains a list of words, separated with spaces, of all features for which support information is available. See the supports chapter in the User manual for more information.

SUPPORTS_feature
contains the value true if that feature is supported by the current browser. See the supports chapter in the User manual for more information.

VARIABLES
contains a list of all form variables.

VAR_name
contains the value of the form variable name.