man mod_cgi () - Invoking of CGI scripts.

NAME

mod_cgi - Invoking of CGI scripts.

DESCRIPTION

This module makes it possible to execute vanilla CGI (Common Gateway Interface) scripts in the server. A file that matches the definition of a ScriptAlias config directive is treated as a CGI script. A CGI script is executed by the server and it's output is returned to the client.

The CGI Script response comprises a message-header and a message-body, separated by a blank line. The message-header contains one or more header fields. The body may be empty. Example:

      "Content-Type:text/plain\nAccept-Ranges:none\n\nsome very plain text"

The server will interpret the cgi-headers and most of them will be transformed into HTTP headers and sent back to the client.

Support for CGI-1.1 is implemented in accordance with the RFC 3875 <http://www.faqs.org/rfcs/rfc3875.html>.

*
ScriptNoCache
*
ScriptTimeout

DIRECTIVE: ScriptNoCache

Syntax: ScritpNoCache true | false

Default: - false -

Module: mod_cgi(3)

If ScriptNoCache is set to true the Web server will by default add the header fields necessary to prevent proxies from caching the page. Generally this is something you want.

ScriptNoCache true

DIRECTIVE: ScriptTimeout

Syntax: ScritpTimeout Seconds

Default: 15

Module: mod_cgi(3)

The time in seconds the web server will wait between each chunk of data from the script. If the CGI-script not delivers any data before the timeout the connection to the client will be closed.

ScriptTimeout  15

EWSAPI MODULE INTERACTION

Uses the following EWSAPI interaction data, if available:

{new_request_uri, NewRequestURI}: as defined in mod_actions(3).
{remote_user, RemoteUser}: as defined in mod_auth(3).

Uses the following EWSAPI functions:

*
mod_alias:real_name/3
*
mod_alias:real_script_name/3
*
mod_cgi:env/3
*
mod_cgi:status_code:env/1

This module furthermore exports a batch of functions to be used by other EWSAPI modules:

EXPORTS

env(Info,Script,AfterScript) -> EnvString

Types
Info = mod_record()

Script = AfterScript = EnvString = string()

Note:

This function should only be used when implementing CGI-1.1 functionality on UNIX platforms.

open_port/2 is normally used to start and interact with CGI scripts. open_port/2 takes an external program as input; env(1) (GNU Shell Utility) is typically used in the case of a CGI script. env(1) execute the CGI script in a modified environment and takes the CGI script and a string of environment variables as input. env/3 returns an appropriate CGI-1.1 environment variable string to be used for this purpose. The environment variables in the string are those defined in the RFC 3875 <http://www.faqs.org/rfcs/rfc3875.html> mod_record() is a record as defined in the EWSAPI Module Programming in the Inets Users Guide.

status_code(CGIOutput) -> {ok,StatusCode} | {error,Reason}

Types
CGIOutput = Reason = string()

StatusCode = integer()

Certain output from CGI scripts has a special meaning, as described in the RFC 3875 <http://www.faqs.org/rfcs/rfc3875.html> , for example if "Location: http://www.yahoo.com\n\n" is returned from a CGI script the client gets automatically redirected to Yahoo! <http://www.yahoo.com>, using the HTTP 302 status code.

SEE ALSO

AUTHORS

Joakim Grebenö  - support@erlang.ericsson.se
Mattias Nilsson  - support@erlang.ericsson.se