ApplicGate
(v12.0.8874.35714 started 2024-04-18 18:00:37 on VM2)

Common Gateway Interface (CGI)

Keyword STARTG:parameterlist ... processing of a GET command
and
Keyword STARTP:parameterlist ... post processing of a POST command after all data has been stored in a file
- Prerequisiste for STARTP is the keyword POST to specify file name and location to store the received data.
- Note: If STARTP is specified and also any files are allowed to be uploaded without post processing and without size limit, then add the parameter list entry *
GatewayIP2 must be web.

parameterlist is a list of entries separated by | with following format:
filter[!progfile[!addargs[!seconds[!options[!respfile]]]]]
or name of a group starting with "C_" that contains entries in the above format
If a line in a group starts with #, it will be not considered (commented out).

- filter is a list of strings separated by ?
-- If the received URL matches one of these strings (case insensitive), the processing will start using this entry.
-- filter strings may contain one or more * as wildcard
-- Option for keyword STARTP: Each filter string may have the following syntax: filter:maxSize
--- maxsize is the maximum size of the received data to be posted to a file
--- Syntax of maxsize is number, numberB, numberKB, numberMB or number GB
--- If maxsize is not specified then there is no size limit.
--- Examples of maxsize: 100, 234B, 12KB, 345MB, 20GB
- progfile ... (optional) name of file to start
-- any * will be replaced by the URL received

- addargs ... (optional) additional arguments for start or empty
-- any * will be replaced by the URL received (this allows start of an extension specific program, e.g. cscript.exe for filter strings .vbs and .js)

- seconds ... (optional) number of seconds to wait for the process to complete (if empty: default value is 30):
-- ..........if seconds=0: infinite wait
-- ..........if seconds >=0: input and output redirection, no shell, no window
-- ..........if seconds <0: no wait, no input and no output redirection, shell is used, window will be shown

- options ... (optional) switches for postprocessing and to reformat output or empty:
-- N ... only for STARTG: No arguments (except addargs) when starting the process
-- S ... if URL ends with ".start" this string will be removed for further processing, example: STARTG:*.start!Shortcuts\*!!-1!NS!.utf8 ... starts any file in Shortcuts (e.g. Test.RDP.start) and shows window
-- Q ... when URL is inserted in addargs: it is decoded with UrlDecode and surrounded with double quotes, e.g. a%5Cb --> "a\b"
-- D ... only for STARTP: delete posted file after processing
-- U ... UrlDecode output
-- H ... HtmlEncode output
-- b ... replace "\n" by "<br>\r\n" within output
-- B ... replace "\r\n" by "<br>\r\n" within output
-- r ... replace "\n" by "<br>" within output
-- R ... replace "\r\n" by "<br>" within output
-- Note: Any combination of U, H, b, B, r, and R can be used and reformatting is processed in this order.
-- M ... signal mail thread to continue (used if an RFC file has been inserted into the pickup directory)
-- X ... standard GET or POST processing will be done, all arguments except filter will not be used

- respfile ... (optional) name of file to return data
-- Any string %output% within respfile will be replaced by the standard output of the process.
-- If respfile starts with ".": Then this is no file name, it is used to get the media type for the response

After successful upload the specified progfile will be executed, arguments are constructed as follows:
- addargs ... if specified by STARTG or STARTP
- for STARTG (if option N not specified): received URL (without leading /), for STARTP: full path of the posted file
- IP address of the source (for STARTG: if option N not specified)
- email name if keyword CCR has been specified (for STARTG: if option N not specified).
- The standard input is filled with the received http header.
- The standard output of the process will be returned using parameter respfile (if any).
- Any standard error will be logged.

Examples:
STARTP:test*!c:\prog\x.exe|* ... files where the name starts with test are processed, all other files are stored without processing
STARTP:"*:10GB!!!!D" ... any file up to the size of 10GB is accepted, it will be deleted after successful upload (this can be used for speed testing)
STARTP:a.txt:10KB?b.txt:20KB ... ony files with name a.txt or b.txt and the appropriate size are accepted

See further CGI examples


ApplicGate Logo  reinhold.leitner@applicgate.com (C) April 2024
www.applicgate.com