<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="previous" href="Netcgi_env.html"> <link rel="next" href="Netcgi.html"> <link rel="Up" href="index.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of class methods" rel=Appendix href="index_methods.html"> <link title="Index of classes" rel=Appendix href="index_classes.html"> <link title="Index of class types" rel=Appendix href="index_class_types.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Netcgi_env" rel="Chapter" href="Netcgi_env.html"> <link title="Netcgi_types" rel="Chapter" href="Netcgi_types.html"> <link title="Netcgi" rel="Chapter" href="Netcgi.html"> <link title="Netcgi_jserv" rel="Chapter" href="Netcgi_jserv.html"> <link title="Netcgi_jserv_ajp12" rel="Chapter" href="Netcgi_jserv_ajp12.html"> <link title="Netcgi_jserv_app" rel="Chapter" href="Netcgi_jserv_app.html"> <link title="Netcgi_fcgi_10" rel="Chapter" href="Netcgi_fcgi_10.html"> <link title="Netcgi_fcgi" rel="Chapter" href="Netcgi_fcgi.html"> <link title="Netcgi1_compat" rel="Chapter" href="Netcgi1_compat.html"><title>Ocamlnet 2 Reference Manual (netcgi1 add-on) : Netcgi_types</title> </head> <body> <div class="navbar"><a href="Netcgi_env.html">Previous</a> <a href="index.html">Up</a> <a href="Netcgi.html">Next</a> </div> <center><h1>Module <a href="type_Netcgi_types.html">Netcgi_types</a></h1></center> <br> <pre><span class="keyword">module</span> Netcgi_types: <code class="code">sig</code> <a href="Netcgi_types.html">..</a> <code class="code">end</code></pre>Basic types for CGI and related protocols<br> <hr width="100%"> <pre><span class="keyword">exception</span> <a name="EXCEPTIONResources_exceeded"></a>Resources_exceeded</pre> <div class="info"> Raised when the CGI input is longer than the configured maximum<br> </div> <pre><span class="keyword">class type</span> <a name="TYPEsimple_message"></a><a href="Netcgi_types.simple_message.html">simple_message</a> = <code class="type">Netmime.mime_body</code></pre><div class="info"> A <code class="code">simple_message</code> stores the value of the CGI argument as an unstructured string value. </div> <pre><span class="keyword">type</span> <a name="TYPEstore"></a><code class="type"></code>store = <code class="type">[ `File of string | `Memory ]</code> </pre> <div class="info"> Determines where the data of the CGI argument are actually stored.<ul> <li><code class="code">`Memory</code>: In an O'Caml string</li> <li><code class="code">`File name</code>: In the file <code class="code">name</code>. The file contains the value of the argument after all transfer-related encodings have been removed (i.e. URL-encoding, and MIME transfer encodings).</li> </ul> <br> </div> <pre><span class="keyword">type</span> <a name="TYPErepresentation"></a><code class="type"></code>representation = <code class="type">[ `MIME of Netmime.mime_message | `Simple of <a href="Netcgi_types.simple_message.html">simple_message</a> ]</code> </pre> <div class="info"> Representations of CGI arguments:<ul> <li><code class="code">`Simple msg</code>: The argument is unstructured</li> <li><code class="code">`MIME msg</code>: The argument has a MIME header in addition to the value</li> </ul> <br> </div> <pre><span class="keyword">class type</span> <a name="TYPEcgi_argument"></a><a href="Netcgi_types.cgi_argument.html">cgi_argument</a> = <code class="code">object</code> <a href="Netcgi_types.cgi_argument.html">..</a> <code class="code">end</code></pre><div class="info"> The interface of CGI argument objects </div> <pre><span class="keyword">type</span> <a name="TYPEcgi_cookie"></a><code class="type"></code>cgi_cookie = <code class="type">Nethttp.cookie</code> = {</pre><table class="typetable"> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>cookie_name : <code class="type">string</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The name of the cookie</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>cookie_value : <code class="type">string</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >The value of the cookie. There are no restrictions on the value of the cookie</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>cookie_expires : <code class="type">float option</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Expiration:<ul> <li><code class="code">None</code>: the cookie expires when the browser session ends.</li> <li><code class="code">Some t</code>: the cookie expires at the time <code class="code">t</code> (seconds since the epoch)</li> </ul> </td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>cookie_domain : <code class="type">string option</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Cookies are bound to a certain domain, i.e. the browser sends them only when web pages of the domain are requested: <p> <ul> <li><code class="code">None</code>: the domain is the hostname of the server</li> <li><code class="code">Some domain</code>: the domain is <code class="code">domain</code></li> </ul> </td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>cookie_path : <code class="type">string option</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Cookies are also bound to certain path prefixes, i.e. the browser sends them only when web pages at the path or below are requested. <p> <ul> <li><code class="code">None</code>: the path is script name + path_info</li> <li><code class="code">Some p</code>: the path is <code class="code">p</code>. With <code class="code">Some "/"</code> you can disable the path restriction completely.</li> </ul> </td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code>cookie_secure : <code class="type">bool</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Cookies are also bound to the type of the web server: <code class="code">false</code> means servers without SSL, <code class="code">true</code> means servers with activated SSL ("https").</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr></table> } <pre><span class="keyword">type</span> <a name="TYPEstatus"></a><code class="type"></code>status = <code class="type">Nethttp.http_status</code> </pre> <pre><span class="keyword">type</span> <a name="TYPErequest_method"></a><code class="type"></code>request_method = <code class="type">[ `DELETE | `GET | `HEAD | `POST | `PUT of <a href="Netcgi_types.cgi_argument.html">cgi_argument</a> ]</code> </pre> <div class="info"> The supported request methods:<ul> <li><code class="code">`GET</code>: Side effect-free request of a web resource</li> <li><code class="code">`POST</code>: Request with side effects</li> <li><code class="code">`HEAD</code>: Only the header of the corresponding <code class="code">`GET</code> are requested</li> <li><code class="code">`DELETE</code>: Request to delete the web resource</li> <li><code class="code">`PUT arg</code>: Request to upload the web resource</li> </ul> <br> </div> <pre><span class="keyword">type</span> <a name="TYPEcache_control"></a><code class="type"></code>cache_control = <code class="type">[ `Max_age of int | `No_cache | `Unspecified ]</code> </pre> <div class="info"> This is only a small subset of the HTTP 1.1 cache control features, but they are usually sufficient, and they work for HTTP/1.0 as well. The directives mean:<ul> <li><code class="code">`No_cache</code>: Caches are disabled. The following headers are sent: <code class="code">Cache-control: no-cache</code>, <code class="code">Pragma: no-cache</code>, <code class="code">Expires:</code> (now - 1 second)</li> <li><code class="code">`Max_age n</code>: Caches are allowed to store a copy of the response for <code class="code">n</code> seconds. After that, the response must be revalidated. <code class="code">Cache-control: max-age n</code>, <code class="code">Cache-control: must-revalidate</code>, <code class="code">Expires:</code> (now + <code class="code">n</code> seconds)</li> <li><code class="code">`Unspecified</code>: No cache control header is added to the response.</li> </ul> Notes:<ul> <li>Cache control directives only apply to GET requests; POST requests are never cached</li> <li>Not only proxies are considered as cache, but also the local disk cache of the browser</li> <li>HTTP/1.0 did not specify cache behaviour as strictly as HTTP/1.1 does. Because of this the <code class="code">Pragma</code> and <code class="code">Expires</code> headers are sent, too. These fields are not interpreted by HTTP/1.1 clients because <code class="code">Cache-control</code> has higher precedence.</li> </ul> <br> </div> <pre><span class="keyword">type</span> <a name="TYPEquery_string_spec"></a><code class="type"></code>query_string_spec = <code class="type">[ `Args of <a href="Netcgi_types.cgi_argument.html">cgi_argument</a> list | `Current | `Initial | `None ]</code> </pre> <div class="info"> Determines how the query part of URLs is generated: <p> <ul> <li><code class="code">`Initial</code>: The query string is created from the initial CGI arguments</li> <li><code class="code">`Current</code>: The query string is created from the current CGI arguments</li> <li><code class="code">`Args l</code>: The query string is created from the specified argument list</li> <li><code class="code">`None</code>: The query string is omitted</li> </ul> <br> </div> <pre><span class="keyword">type</span> <a name="TYPEother_url_spec"></a><code class="type"></code>other_url_spec = <code class="type">[ `Env | `None | `This of string ]</code> </pre> <div class="info"> Determines how an URL part is generated: <p> <ul> <li><code class="code">`Env</code>: Take the value from the environment</li> <li><code class="code">`This v</code>: Use this value <code class="code">v</code>. It must already be URL-encoded.</li> <li><code class="code">`None</code>: Do not include this part into the URL</li> </ul> <br> </div> <pre><span class="keyword">class type</span> <a name="TYPEcgi_activation"></a><a href="Netcgi_types.cgi_activation.html">cgi_activation</a> = <code class="code">object</code> <a href="Netcgi_types.cgi_activation.html">..</a> <code class="code">end</code></pre><div class="info"> The common interface of CGI activation objects </div> </body></html>