1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<link rel="stylesheet" href="style.css" type="text/css">
5
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
6
<link rel="Start" href="index.html">
7
<link rel="next" href="Netcgi_types.html">
8
<link rel="Up" href="index.html">
9
<link title="Index of types" rel=Appendix href="index_types.html">
10
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
11
<link title="Index of values" rel=Appendix href="index_values.html">
12
<link title="Index of class methods" rel=Appendix href="index_methods.html">
13
<link title="Index of classes" rel=Appendix href="index_classes.html">
14
<link title="Index of class types" rel=Appendix href="index_class_types.html">
15
<link title="Index of modules" rel=Appendix href="index_modules.html">
16
<link title="Netcgi_env" rel="Chapter" href="Netcgi_env.html">
17
<link title="Netcgi_types" rel="Chapter" href="Netcgi_types.html">
18
<link title="Netcgi" rel="Chapter" href="Netcgi.html">
19
<link title="Netcgi_jserv" rel="Chapter" href="Netcgi_jserv.html">
20
<link title="Netcgi_jserv_ajp12" rel="Chapter" href="Netcgi_jserv_ajp12.html">
21
<link title="Netcgi_jserv_app" rel="Chapter" href="Netcgi_jserv_app.html">
22
<link title="Netcgi_fcgi_10" rel="Chapter" href="Netcgi_fcgi_10.html">
23
<link title="Netcgi_fcgi" rel="Chapter" href="Netcgi_fcgi.html">
24
<link title="Netcgi1_compat" rel="Chapter" href="Netcgi1_compat.html"><title>Ocamlnet 2 Reference Manual (netcgi1 add-on) : Netcgi_env</title>
27
<div class="navbar"> <a href="index.html">Up</a>
28
<a href="Netcgi_types.html">Next</a>
30
<center><h1>Module <a href="type_Netcgi_env.html">Netcgi_env</a></h1></center>
32
<pre><span class="keyword">module</span> Netcgi_env: <code class="code">sig</code> <a href="Netcgi_env.html">..</a> <code class="code">end</code></pre>Access to the environment for CGI and related protocols<br>
34
<pre><span class="keyword">type</span> <a name="TYPEinput_mode"></a><code class="type"></code>input_mode = <code class="type">[ `Standard ]</code> </pre>
36
Determines how to read the request:<ul>
37
<li><code class="code">`Standard</code>: Only the request body is read from the input
38
channel (CGI standard)</li>
39
<li>Not yet implemented: <code class="code">`Direct</code>: Both header and body of the
40
request are read from the input channel</li>
45
<pre><span class="keyword">type</span> <a name="TYPEinput_state"></a><code class="type"></code>input_state = <code class="type">[ `Received_body<br> | `Received_header<br> | `Receiving_body<br> | `Receiving_header<br> | `Start ]</code> </pre>
47
The input processing state:<ul>
48
<li><code class="code">`Start</code>: Input data have not yet been received</li>
49
<li><code class="code">`Receiving_header</code>: The request header is currently being
51
<li><code class="code">`Received_header</code>: The request header has been completely
52
received, and nothing of the request body has yet been
54
<li><code class="code">`Receiving_body</code>: The request body is currently being
56
<li><code class="code">`Received_body</code>: The request body has been completely
61
<pre><code class="code">
63
`Receiving_header ->
64
`Received_header ->
66
`Received_body </code></pre><br>
69
<pre><span class="keyword">type</span> <a name="TYPEoutput_mode"></a><code class="type"></code>output_mode = <code class="type">[ `Standard ]</code> </pre>
71
Determines how to deliver the response:<ul>
72
<li><code class="code">`Standard</code>: The format of the response header has CGI format,
73
followed by the response body</li>
74
<li>Not yet implemented: <code class="code">`Direct</code>: The format of the response
75
header has HTTP format, followed by the response body. This
76
is also known as "non-parsed header" format.</li>
81
<pre><span class="keyword">type</span> <a name="TYPEoutput_state"></a><code class="type"></code>output_state = <code class="type">[ `End<br> | `Sending_body<br> | `Sending_header<br> | `Sending_part_body<br> | `Sending_part_header<br> | `Sent_body<br> | `Sent_header<br> | `Sent_part_body<br> | `Sent_part_header<br> | `Start ]</code> </pre>
83
The output processing state:<ul>
84
<li><code class="code">`Start</code>: Output has not yet been sent</li>
85
<li><code class="code">`Sending_header</code>: The response header is currently being sent</li>
86
<li><code class="code">`Sent_header</code>: The response header has been completely sent,
87
and nothing of the body has yet been sent</li>
88
<li><code class="code">`Sending_body</code>: The response body is currently being sent</li>
89
<li><code class="code">`Sent_body</code>: The response body has been sent up to a
91
<li><code class="code">`End</code>: The response has been completely sent</li>
95
<pre><code class="code"> `Start ->
107
The state <code class="code">`Sent_body</code> is reached when the output data are
108
committed. It is possible to continue with another transaction,
109
which would mean to go back to <code class="code">`Sending_body</code>, or to finish
110
the body completely, by going to <code class="code">`End</code>.
113
Extension for multi-part response messages (e.g. needed for
114
server push, not yet implemented):<ul>
115
<li><code class="code">`Sending_part_header</code>: The header of a message part is being
117
<li><code class="code">`Sent_part_header</code>: The header of a message part has been
119
<li><code class="code">`Sending_part_body</code>: The body of a message part is being
121
<li><code class="code">`Sent_part_body</code>: The body of a message part has been sent
122
up to a check point</li>
127
<pre><span class="keyword">type</span> <a name="TYPEprotocol_version"></a><code class="type"></code>protocol_version = <code class="type">Nethttp.protocol_version</code> </pre>
129
Now defined in <code class="code">Nethttp</code><br>
132
<pre><span class="keyword">type</span> <a name="TYPEprotocol_attribute"></a><code class="type"></code>protocol_attribute = <code class="type">Nethttp.protocol_attribute</code> </pre>
134
Now defined in <code class="code">Nethttp</code><br>
137
<pre><span class="keyword">type</span> <a name="TYPEprotocol"></a><code class="type"></code>protocol = <code class="type">Nethttp.protocol</code> </pre>
139
Now defined in <code class="code">Nethttp</code><br>
142
<pre><span class="keyword">type</span> <a name="TYPEworkaround"></a><code class="type"></code>workaround = <code class="type">[ `Work_around_MSIE_Content_type_bug | `Work_around_backslash_bug ]</code> </pre>
144
Indicates special behaviour:<ul>
145
<li><code class="code">`Work_around_MSIE_Content_type_bug</code>: Versions of the Internet
146
Explorer send illegal content types. This workaround extracts
147
the right data from the malformed data field</li>
148
<li><code class="code">`Work_around_backslash_bug</code>: Almost all browsers send illegal
149
backslash sequences when backslashes occur in filenames.
150
This workaround accepts such sequences.</li>
155
<br><code><span class="keyword">type</span> <a name="TYPEcgi_config"></a><code class="type"></code>cgi_config = {</code><table class="typetable">
157
<td align="left" valign="top" >
158
<code> </code></td>
159
<td align="left" valign="top" >
160
<code>tmp_directory : <code class="type">string</code>;</code></td>
161
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The directory where to create temporary files. This should be
162
an absolute path name</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
165
<td align="left" valign="top" >
166
<code> </code></td>
167
<td align="left" valign="top" >
168
<code>tmp_prefix : <code class="type">string</code>;</code></td>
169
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The name prefix for temporary files. This must be a non-empty
170
string. It must not contain '/'.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
173
<td align="left" valign="top" >
174
<code> </code></td>
175
<td align="left" valign="top" >
176
<code>permitted_http_methods : <code class="type">string list</code>;</code></td>
177
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The list of accepted HTTP methods (uppercase letters)</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
180
<td align="left" valign="top" >
181
<code> </code></td>
182
<td align="left" valign="top" >
183
<code>permitted_input_content_types : <code class="type">string list</code>;</code></td>
184
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The list of accepted content types in requests.
185
Content type parameters (like "charset") are ignored.
186
If the list is empty, all content types are allowed.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
189
<td align="left" valign="top" >
190
<code> </code></td>
191
<td align="left" valign="top" >
192
<code>input_content_length_limit : <code class="type">int</code>;</code></td>
193
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The maximum size of the request</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
196
<td align="left" valign="top" >
197
<code> </code></td>
198
<td align="left" valign="top" >
199
<code>workarounds : <code class="type"><a href="Netcgi_env.html#TYPEworkaround">workaround</a> list</code>;</code></td>
200
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The list of enabled workarounds</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
205
<pre><span class="keyword">val</span> <a name="VALdefault_config"></a>default_config : <code class="type"><a href="Netcgi_env.html#TYPEcgi_config">cgi_config</a></code></pre><div class="info">
206
The default configuration is:<ul>
207
<li><code class="code">tmp_directory</code>: one of /var/tmp, /tmp, C:\temp, .</li>
208
<li><code class="code">tmp_prefix</code>: "netstring"</li>
209
<li><code class="code">permitted_http_methods</code>: <code class="code">"GET"</code>, <code class="code">"POST"</code></li>
210
<li><code class="code">permitted_input_content_types</code>: <code class="code">"multipart/form-data"</code>,
211
<code class="code">"application/x-www-form-urlencoded"</code></li>
212
<li><code class="code">input_content_length_limit</code>: <code class="code">maxint</code></li>
213
<li><code class="code">workarounds</code>: all</li>
216
To create a custom configuration, it is suggested to use this
218
<pre><code class="code"> let custom_config =
219
{ default_config with tmp_prefix = "my_prefix" }
222
<pre><span class="keyword">class type</span> <a name="TYPEcgi_environment"></a><a href="Netcgi_env.cgi_environment.html">cgi_environment</a> = <code class="code">object</code> <a href="Netcgi_env.cgi_environment.html">..</a> <code class="code">end</code></pre><div class="info">
223
The class type cgi_environment contains the resources by which
224
the CGI activation is connected to the "outer world".
226
<pre><span class="keyword">exception</span> <a name="EXCEPTIONStd_environment_not_found"></a>Std_environment_not_found</pre>
228
Indicates that the process environment does not contain the
229
variables that are typical of CGI<br>
231
<pre><span class="keyword">class</span> <a name="TYPEstd_environment"></a><a href="Netcgi_env.std_environment.html">std_environment</a> : <code class="type">?config:<a href="Netcgi_env.html#TYPEcgi_config">cgi_config</a> -> unit -> </code><code class="type"><a href="Netcgi_env.cgi_environment.html">cgi_environment</a></code></pre><div class="info">
232
An implementation of <code class="code">cgi_environment</code>, intended to be used
235
<pre><span class="keyword">class</span> <a name="TYPEtest_environment"></a><a href="Netcgi_env.test_environment.html">test_environment</a> : <code class="type">?config:<a href="Netcgi_env.html#TYPEcgi_config">cgi_config</a> -> unit -> </code><code class="type"><a href="Netcgi_env.cgi_environment.html">cgi_environment</a></code></pre><div class="info">
236
An implementation of <code class="code">cgi_environment</code>, intended to test CGI
237
programs from the command-line.
239
<pre><span class="keyword">class</span> <a name="TYPEcustom_environment"></a><a href="Netcgi_env.custom_environment.html">custom_environment</a> : <code class="type">?config:<a href="Netcgi_env.html#TYPEcgi_config">cgi_config</a> -> unit -> </code><code class="code">object</code> <a href="Netcgi_env.custom_environment.html">..</a> <code class="code">end</code></pre><div class="info">
240
This class can be used to set up non-standard environments.
b'\\ No newline at end of file'