Class Netcgi.custom_activation


class custom_activation : ?env:Netcgi_env.cgi_environment -> ?args:Netcgi_types.cgi_argument list -> ?meth:Netcgi_types.request_method -> ?operating_type:operating_type -> unit -> Netcgi_types.cgi_activation
This class can be used to implement a non-standard connector that has the same output format as CGI. The CGI arguments, however, are not extracted from the input channel, but simply passed as args to this class. The input channel of the environment is never used.

The class does not modify any property of the environment, and it does not check whether the environment is compatible with the passed method and arguments. This is up to the user.

The purpose of the custom activation class is that CGI environments can be created that do not communicate over stdin/stdout, but use other means to get their input and to deliver their output. You could do that by providing a customized cgi_environment as well, but this alternate solution might be ineffective because CGI arguments must be encoded for the only purpose to be immediately decoded by std_activation. When using custom_activation, one can bypass the environment, and set the CGI arguments directly.

Note: Unlike std_activation, this class sets the set of current arguments and the set of initial arguments to the same list. This means: if you modify an argument directly (set_value, for instace) this will change both sets. It is recommended to pass only read-only arguments to this class in order to avoid this surprising behaviour.


env : The default environment is to first try a classical CGI environment, and if that fails, to fall back to a test environment.
args : The list of CGI arguments that will be available in the CGI activation object
meth : The assumed HTTP method. The method is not extracted from the environment, but taken from this argument. Defaults to `GET.
operating_type : See std_activation.