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 its output is returned to the client.
Support for CGI-1.1 is implemented in accordance with the CGI-1.1 specification.
CGI is currently available for Erlang/OTP running on a UNIX platform. These number of platforms will be increased. |
Uses the following EWSAPI interaction data, if available:
{new_request_uri,NewRequestURI}
{remote_user,RemoteUser}
Uses the following EWSAPI functions:
This module furthermore exports a batch of functions to be used by other EWSAPI modules:
env(Info,Script,AfterScript) -> EnvString
Info = mod_record()
Script = AfterScript = EnvString = string()
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
CGI-1.1
specification. mod_record()
is a record as defined
in the EWSAPI Module
Programming section of httpd(3)
.
status_code(CGIOutput) -> {ok,StatusCode} | {error,Reason}
CGIOutput = Reason = string()
StatusCode = integer()
Certain output from CGI scripts has a special meaning, as
described in the
CGI
specification, for example if "Location:
http://www.yahoo.com\n\n"
is returned from a CGI script
the client gets automatically redirected to Yahoo!, using the HTTP 302
status code (RFC 1945).