<!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="Ocsigen_http_client.html"> <link rel="next" href="Ocsigen_server.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 modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Ocsigen_cache" rel="Chapter" href="Ocsigen_cache.html"> <link title="Ocsigen_lib_base" rel="Chapter" href="Ocsigen_lib_base.html"> <link title="Ocsigen_lib" rel="Chapter" href="Ocsigen_lib.html"> <link title="Ocsigen_config" rel="Chapter" href="Ocsigen_config.html"> <link title="Ocsigen_getcommandline" rel="Chapter" href="Ocsigen_getcommandline.html"> <link title="Ocsigen_messages" rel="Chapter" href="Ocsigen_messages.html"> <link title="Ocsigen_stream" rel="Chapter" href="Ocsigen_stream.html"> <link title="Ocsigen_loader" rel="Chapter" href="Ocsigen_loader.html"> <link title="Polytables" rel="Chapter" href="Polytables.html"> <link title="Http_headers" rel="Chapter" href="Http_headers.html"> <link title="Ocsigen_http_frame" rel="Chapter" href="Ocsigen_http_frame.html"> <link title="Ocsigen_headers" rel="Chapter" href="Ocsigen_headers.html"> <link title="Framepp" rel="Chapter" href="Framepp.html"> <link title="Ocsigen_http_com" rel="Chapter" href="Ocsigen_http_com.html"> <link title="Ocsigen_charset_mime" rel="Chapter" href="Ocsigen_charset_mime.html"> <link title="Ocsigen_senders" rel="Chapter" href="Ocsigen_senders.html"> <link title="Ocsigen_cookies" rel="Chapter" href="Ocsigen_cookies.html"> <link title="Ocsigen_extensions" rel="Chapter" href="Ocsigen_extensions.html"> <link title="Ocsigen_parseconfig" rel="Chapter" href="Ocsigen_parseconfig.html"> <link title="Ocsigen_http_client" rel="Chapter" href="Ocsigen_http_client.html"> <link title="Ocsigen_local_files" rel="Chapter" href="Ocsigen_local_files.html"> <link title="Ocsigen_server" rel="Chapter" href="Ocsigen_server.html"> <link title="Ocsigen_comet" rel="Chapter" href="Ocsigen_comet.html"> <link title="Accesscontrol" rel="Chapter" href="Accesscontrol.html"> <link title="Authbasic" rel="Chapter" href="Authbasic.html"> <link title="Ocsipersist" rel="Chapter" href="Ocsipersist.html"><title>Ocsigen_local_files</title> </head> <body> <div class="navbar"><a class="pre" href="Ocsigen_http_client.html" title="Ocsigen_http_client">Previous</a> <a class="up" href="index.html" title="Index">Up</a> <a class="post" href="Ocsigen_server.html" title="Ocsigen_server">Next</a> </div> <h1>Module <a href="type_Ocsigen_local_files.html">Ocsigen_local_files</a></h1> <pre><span class="keyword">module</span> Ocsigen_local_files: <code class="code">sig</code> <a href="Ocsigen_local_files.html">..</a> <code class="code">end</code></pre><div class="info module top"> The requested file does not exists<br> </div> <hr width="100%"> <pre><span id="EXCEPTIONFailed_404"><span class="keyword">exception</span> Failed_404</span></pre> <div class="info "> The requested file cannot be served: does not exists, not enough permissions ...<br> </div> <pre><span id="EXCEPTIONFailed_403"><span class="keyword">exception</span> Failed_403</span></pre> <div class="info "> The file is a directory which we should not display<br> </div> <pre><span id="EXCEPTIONNotReadableDirectory"><span class="keyword">exception</span> NotReadableDirectory</span></pre> <pre><code><span id="TYPEresolved"><span class="keyword">type</span> <code class="type"></code>resolved</span> = </code></pre><table class="typetable"> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTresolved.RFile"><span class="constructor">RFile</span></span> <span class="keyword">of</span> <code class="type">string</code></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTresolved.RDir"><span class="constructor">RDir</span></span> <span class="keyword">of</span> <code class="type">string</code></code></td> </tr></table> <div class="info "> Local file corresponding to a request. The string argument represents the real file or directory to serve, eg. foo/index.html instead of foo<br> </div> <pre><span id="VALresolve"><span class="keyword">val</span> resolve</span> : <code class="type">?no_check_for:string -><br> request:<a href="Ocsigen_extensions.html#TYPErequest">Ocsigen_extensions.request</a> -><br> filename:string -> unit -> <a href="Ocsigen_local_files.html#TYPEresolved">resolved</a></code></pre><div class="info "> Finds <code class="code">filename</code> in the filesystem, with a possible redirection if it is a directory. Takes into account the fact that <code class="code">filename</code> does not exists, is a symlink or is a directory, and raises Failed_404 or Failed_403 accordingly. <p> <ul> <li>we return <code class="code">"filename/index.html"</code> if <code class="code">filename</code> corresponds to a directory, <code class="code">"filename/index.html"</code> is valid, and <code class="code">"index.html"</code> is one possible index (trying all possible indexes in order)</li> <li>we raise <code class="code">Failed_404</code> if <code class="code">filename</code> corresponds to a directory, no index exists and <code class="code">list_dir_content</code> is false. Warning: this behaviour is not the same as Apache's but it corresponds to a missing service in Eliom (answers 404). This also allows to have an Eliom service after a "forbidden" directory</li> <li>we raise <code class="code">Failed_403</code> if <code class="code">filename</code> is a symlink that must not be followed</li> <li>raises <code class="code">Failed_404</code> if <code class="code">filename</code> does not exist, or is a special file</li> <li>otherwise returns <code class="code">filename</code></li> </ul> <code class="code">no_check_for</code> is supposed to be a prefix of <code class="code">filename</code> ; directories above <code class="code">no_check_for</code> are not checked for symlinks<br> </div> <pre><span id="VALcontent"><span class="keyword">val</span> content</span> : <code class="type">request:<a href="Ocsigen_extensions.html#TYPErequest">Ocsigen_extensions.request</a> -><br> file:<a href="Ocsigen_local_files.html#TYPEresolved">resolved</a> -> <a href="Ocsigen_http_frame.html#TYPEresult">Ocsigen_http_frame.result</a> Lwt.t</code></pre><div class="info "> Given the local file <code class="code">file</code>, with a request originating at url <code class="code">url</code>, returns a viewable content of <code class="code">file</code>. Currently, the <code class="code">url</code> parameter is used only if <code class="code">url</code> is a directory<br> </div> </body></html>