class type cgi_environment =object
..end
The following properties are standardised by CGI. The methods
return ""
(or None
in the case of the port number) when the
property is not available.
method cgi_gateway_interface : string
method cgi_server_name : string
method cgi_server_port : int option
method cgi_server_protocol : string
method cgi_server_software : string
method cgi_request_method : string
Netcgi.cgi.request_method
which is more type-safe and informative.method cgi_script_name : string
method cgi_path_info : string
method cgi_path_translated : string
method cgi_auth_type : string
method cgi_remote_addr : string
method cgi_remote_host : string
method cgi_remote_user : string
method cgi_remote_ident : string
method cgi_query_string : string
Netcgi.cgi
class gives
you an easy access to the arguments through the #arg...
methods.method protocol : Nethttp.protocol
`Http((major,minor),attributes)
or`Other
.method cgi_property : ?default:string -> string -> string
Not_found
is be raised unless
the default
argument is passed. The default
argument
determines the result of the function in this case.
The method takes the case-sensitive name and returns the value of the property. Usually, these properties have uppercase names.
For example, cgi_gateway_interface
returns the same as
cgi_property ~default:"" "GATEWAY_INTERFACE"
You cannot access the fields coming from the HTTP header. Use
the method input_header_field
instead.
method cgi_properties : (string * string) list
method cgi_https : bool
method input_header : Netmime.mime_header
method input_header_field : ?default:string -> string -> string
#input_header_field ?default f
returns the value of a field
f
of the HTTP request header. The field name f
is
case-insensitive; if the name is a compound name, the parts
are separated by "-", e.g. "content-length"
. If there are
several fields with the same name only the first field will be
returned.Not_found
if the field does not exist, unless the
default
argument is passed. The default
argument is the
result of the function in this case.method multiple_input_header_field : string -> string list
method input_header_fields : (string * string) list
string -> Cookie.t
: #cookie cn
returns the cookie with name cn
.Not_found
if such a cookie does not exists.Cookie.t list
: method user_agent : string
"User-agent"
field of the HTTP request header.method input_content_length : int
"Content-length"
request header field.Not_found
if it is not set.method input_content_type_string : string
"Content-type"
request header field as a plain
string or ""
if it is not set.method input_content_type : unit -> string * (string * Netmime_string.s_param) list
"Content-type"
request header field.Not_found
if it is not set.
See also Netmime_string.scan_mime_type_ep
.method output_header : Netmime.mime_header
method output_header_field : ?default:string -> string -> string
Not_found
will be raised unless the
default
argument is passed. The default
argument determines
the result of the function in this case.
If there are several fields with the same name only the first field will be returned.
The anonymous string is the name of the field. The name is
case-insensitive, and it does not matter whether it consists
of lowercase or uppercase letters. If the name is a compound
name, the parts are separated by "-", e.g. "content-length"
.
method multiple_output_header_field : string -> string list
method output_header_fields : (string * string) list
method set_output_header_field : string -> string -> unit
method set_multiple_output_header_field : string -> string list -> unit
method set_output_header_fields : (string * string) list -> unit
method set_status : Nethttp.http_status -> unit
Status
output header field.method send_output_header : unit -> unit
`Transactionnal
(as opposed to `Direct
), no output will
actually take place before you issue #commit_work()
-- thus
a #rollback_work()
will also rollback the headers as
expected.method output_ch : Netchannels.out_obj_channel
#out_channel
instead.method out_channel : Netchannels.out_obj_channel
Netcgi.cgi
#out_channnel
which supports transactions (if you
choose to). Access to the "raw" channel is useful however,
for example for sending images or download of files (for which
transactions are not interesting but merely more work).method log_error : string -> unit
#log_error msg
appends msg
to the webserver log.method config : config