class type cgi_activation =The common interface of CGI activation objectsobject..end
method environment : Netcgi_env.cgi_environmentmethod request_method : request_methodInitial arguments are the CGI arguments at the time the arguments were parsed from the environment.
method initial_arguments : (string * cgi_argument) listmethod initial_argument : string -> cgi_argumentNot_foundmethod initial_argument_value : ?default:string -> string -> stringdefault is returned. The
default defaults to "".method initial_multiple_argument : string -> cgi_argument listThe current arguments can be modified, but they are initialized to the initial arguments at object creation time:
method arguments : (string * cgi_argument) listmethod argument : string -> cgi_argumentNot_foundmethod argument_value : ?default:string -> string -> stringdefault is returned. The
default defaults to "".method multiple_argument : string -> cgi_argument listmethod set_arguments : ?fin:bool -> cgi_argument list -> unitfin : If true, the default, the arguments of the old set
that are not member of the new set are finalizedmethod update_argument : ?fin:bool -> cgi_argument -> unitfin : If true, the default, the replaced arguments are
finalized (unless they happen to be the same as the new argument)method update_multiple_argument : ?fin:bool -> cgi_argument list -> unitfin : If true, the default, the replaced arguments are
finalized (unless they happen to be the same as the new arguments)method delete_argument : ?fin:bool -> string -> unitfin : If true, the default, the deleted arguments are
finalizedmethod url : ?protocol:Netcgi_env.protocol ->
?with_authority:other_url_spec ->
?with_script_name:other_url_spec ->
?with_path_info:other_url_spec ->
?with_query_string:query_string_spec -> unit -> string
protocol: The URL scheme. By default, the URL scheme is used
that is described in the environmentwith_authority: Whether to include authority part of the URL, and
if yes, from which source. Default: `Envwith_script_name: Whether to include the part of the URL path
identifying the CGI script, and if yes, from which source.
Default: `Envwith_path_info: Whether to include the rest of the URL path
exceeding the script name, and if yes, from which source.
Default: `Envwith_query_string: Whether to include the query string,
and if yes, which one. Default: `None, i.e. no query stringmethod output : Netchannels.trans_out_obj_channel
The output channel may have transactional semantics, and because of
this, it is an trans_out_obj_channel. Implementations are free
to support transactions or not.
After all data have been written, the method commit_work must be
called, even if there is no support for transactions.
Simple Example:
cgi # output # output_string "Hello world!\n";
cgi # output # commit_work()
Example for an error handler and a transaction buffer: If an error happens, it is possible to roll the channel back, and to write the error message.
try
cgi # set_header ... ();
cgi # output # output_string "Hello World!"; ...
cgi # output # commit_work();
with
err ->
cgi # output # rollback_work();
cgi # set_header ... ();
cgi # output # output_string "Software error!"; ...
cgi # output # commit_work();
method set_header : ?status:status ->
?content_type:string ->
?cache:cache_control ->
?filename:string ->
?language:string ->
?script_type:string ->
?style_type:string ->
?set_cookie:cgi_cookie list ->
?fields:(string * string list) list -> unit -> unitWhen the output channel supports transactions, it is possible to set the header until the channel is commited for the first time. When there is no support for transactions, the header must be set before the first byte of output is written.
If set_header is called several times, all of the header fields
are overwritten.
status: Sets the HTTP status of the reply. Defaults to "no status",
but the server normally complements an `Ok status in this casecontent_type: Sets the content type. Defaults to "text/html" if the
content type is not yet set.cache: Sets the cache behavior for replies to GET requests. The
default is `Unspecified. It is strongly recommended to specify
the caching behaviour!!! You are on the safe side with `No_cache,
forcing every page to be regenerated. If your data do not change
frequently, `Max_age n tells the caches to store the data at most
n seconds.filename: Sets the filename associated with the page. This filename
is taken for the "save as..." dialog. Default: no filename.
Note: It is bad practice if the filename contains problematic characters
(backslash, double quote, space), or the names of directoriesscript_type: Sets the language of the script tag (for HTML replies).
It is recommended to use this field if there are ONXXX attributes
containing scripts before the first <SCRIPT> element, because you
cannot specify the script language for the ONXXX attributes otherwise.
script_type must be a media type, e.g. "text/javascript".
Default: no language is specified.style_type: Sets the language of the style tag (for HTML replies).
It is recommended to use this field if there are STYLE attributes
containing scripts before the first <STYLE> element, because you
cannot specify the style language for the STYLE attributes otherwise.
style_type must be a media type, e.g. "text/css".
Default: no language is specified.set_cookie: Sets a number of cookies.
Default: []
You can query the cookies using environment#cookies.fields: Sets other fields of the header.method set_redirection_header : string -> unitmethod finalize : unit -> unitfinalize for every CGI argument to ensure that
all files are deleted.
It does not close the in/out channels, however.
This method is not registered in the garbage collector, and it is
a bad idea to do so.