GateCGI component can handle particular file
extensions. You can use configuration section formatted as described below for every file
type that must be executed as a CGI. Depending on the way the CGI is executed you can
think that there are two types of CGI - directly executed and scripts processed by a
processor (such as language interpreters - perl, awk, php, cmd and many others). See notes
after section description for more details.
{ extension: (CG.newObjects.GateCGI)
; These are the standard entries for the Execution map - see Execution map in the alp.application
(int)Timeout=60
(int)RequireAsynch=2
(int)CheckThatFileExists=2
(int)IsScriptEngine=1
; Specific GateCGI entries
; Engine entry can appear in 3 forms - Engine :Engine or .Engine but most useful
; is the first one. This record entry can be omitted.
(string)Engine=cmd.exe /Q /C ""%r\cgi\lister.cmd" "%s" %q"
; Useful for developers - instead of returning error to the core if set to 1 GateCGI
; Displays beginning of the CGI output in plain text format if error occurs.
(int)ShowErrOutputSample=1
; Optional section that defines custom environment variables for the executed
; application
{ ENVIRONMENT:
(string)MYVARIABLE=Value
} ENVIRONMENT;
} extension;
- extension - specifies a file extension to be
handled. If the file extension determines a file type directly executed by the system
Engine section can be omitted. Files of that type will be executed directly - ALP ships
with exe files allowed for CGI execution in the global/default alp.application file. If
the extension specifies some other file type Engine entry must present in order to
determine how to execute the file.
- Engine - Specifies how to execute the file. this record entry
allows many options. GateCGI uses this string in order to determine what program to use
and what parameters to pass. First for a similarity with another ALP options syntax it
supports 3 forms:
- ShowErrOutputSample - Developers can
set this in order to receive plain text output containing the output of the program
executed when it fails to return enough headers. Very useful in case if mistake in the
command line parameters and options passed to it.
- ENVIRONMENT - this subsection (if not
omitted) can be used to add or replace environment variables in the environment passed to
the executed application. You may specify any (string)Name=Value record entry here and it
will be available in the environment. Variables found here will replace standard variables
generated by the GateCGI if their names are equal but will not replace variables found in
the initial environment (of the executable running ALP). From ALP
version 1.2 you can use also extended syntax for the
values:
You can include %NAME% values which will be expanded when
placed in the environment. The NAME can be one of the already
defined ALP variables - a previous variable specified in this
section or ALP internal variable see the GateCGI
Content Generator for their list and contents.
|