module Netcgi_env:Access to the environment for CGI and related protocolssig
..end
typeinput_mode =
[ `Standard ]
`Standard
: Only the request body is read from the input
channel (CGI standard)`Direct
: Both header and body of the
request are read from the input channeltypeinput_state =
[ `Received_body
| `Received_header
| `Receiving_body
| `Receiving_header
| `Start ]
`Start
: Input data have not yet been received`Receiving_header
: The request header is currently being
received`Received_header
: The request header has been completely
received, and nothing of the request body has yet been
received`Receiving_body
: The request body is currently being
received`Received_body
: The request body has been completely
received
`Start ->
`Receiving_header ->
`Received_header ->
`Receiving_body ->
`Received_body
typeoutput_mode =
[ `Standard ]
`Standard
: The format of the response header has CGI format,
followed by the response body`Direct
: The format of the response
header has HTTP format, followed by the response body. This
is also known as "non-parsed header" format.typeoutput_state =
[ `End
| `Sending_body
| `Sending_header
| `Sending_part_body
| `Sending_part_header
| `Sent_body
| `Sent_header
| `Sent_part_body
| `Sent_part_header
| `Start ]
`Start
: Output has not yet been sent`Sending_header
: The response header is currently being sent`Sent_header
: The response header has been completely sent,
and nothing of the body has yet been sent`Sending_body
: The response body is currently being sent`Sent_body
: The response body has been sent up to a
check point`End
: The response has been completely sent `Start ->
`Sending_header ->
`Sent_header ->
+-> `Sending_body
| |
| V
+-- `Sent_body
|
V
`End
The state `Sent_body
is reached when the output data are
committed. It is possible to continue with another transaction,
which would mean to go back to `Sending_body
, or to finish
the body completely, by going to `End
.
Extension for multi-part response messages (e.g. needed for server push, not yet implemented):
`Sending_part_header
: The header of a message part is being
sent`Sent_part_header
: The header of a message part has been
completely sent`Sending_part_body
: The body of a message part is being
sent`Sent_part_body
: The body of a message part has been sent
up to a check pointtypeprotocol_version =
Nethttp.protocol_version
Nethttp
typeprotocol_attribute =
Nethttp.protocol_attribute
Nethttp
typeprotocol =
Nethttp.protocol
Nethttp
typeworkaround =
[ `Work_around_MSIE_Content_type_bug | `Work_around_backslash_bug ]
`Work_around_MSIE_Content_type_bug
: Versions of the Internet
Explorer send illegal content types. This workaround extracts
the right data from the malformed data field`Work_around_backslash_bug
: Almost all browsers send illegal
backslash sequences when backslashes occur in filenames.
This workaround accepts such sequences.type
cgi_config = {
|
tmp_directory : |
(* | The directory where to create temporary files. This should be an absolute path name | *) |
|
tmp_prefix : |
(* | The name prefix for temporary files. This must be a non-empty string. It must not contain '/'. | *) |
|
permitted_http_methods : |
(* | The list of accepted HTTP methods (uppercase letters) | *) |
|
permitted_input_content_types : |
(* | The list of accepted content types in requests. Content type parameters (like "charset") are ignored. If the list is empty, all content types are allowed. | *) |
|
input_content_length_limit : |
(* | The maximum size of the request | *) |
|
workarounds : |
(* | The list of enabled workarounds | *) |
val default_config : cgi_config
tmp_directory
: one of /var/tmp, /tmp, C:\temp, .tmp_prefix
: "netstring"permitted_http_methods
: "GET"
, "POST"
permitted_input_content_types
: "multipart/form-data"
,
"application/x-www-form-urlencoded"
input_content_length_limit
: maxint
workarounds
: all let custom_config =
{ default_config with tmp_prefix = "my_prefix" }
class type cgi_environment =object
..end
exception Std_environment_not_found
class std_environment :?config:cgi_config -> unit ->
cgi_environment
cgi_environment
, intended to be used
for classical CGI.
class test_environment :?config:cgi_config -> unit ->
cgi_environment
cgi_environment
, intended to test CGI
programs from the command-line.
class custom_environment :?config:cgi_config -> unit ->
object
..end