diff options
Diffstat (limited to 'docs/manual/mod/mod_lua.html.en')
-rw-r--r-- | docs/manual/mod/mod_lua.html.en | 86 |
1 files changed, 59 insertions, 27 deletions
diff --git a/docs/manual/mod/mod_lua.html.en b/docs/manual/mod/mod_lua.html.en index 506ce7e..8b0ede5 100644 --- a/docs/manual/mod/mod_lua.html.en +++ b/docs/manual/mod/mod_lua.html.en @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head> -<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" /> +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX This file is generated from xml source: DO NOT EDIT @@ -27,13 +27,13 @@ <div id="preamble"><h1>Apache Module mod_lua</h1> <div class="toplang"> <p><span>Available Languages: </span><a href="../en/mod/mod_lua.html" title="English"> en </a> | -<a href="../fr/mod/mod_lua.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> +<a href="../fr/mod/mod_lua.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> </div> <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides Lua hooks into various portions of the httpd request processing</td></tr> <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr> -<tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>lua_module</td></tr> -<tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_lua.c</td></tr> +<tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>lua_module</td></tr> +<tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_lua.c</td></tr> <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>2.3 and later</td></tr></table> <h3>Summary</h3> @@ -78,6 +78,7 @@ trust, as it can be abused to change the internal workings of httpd.</p> <li><img alt="" src="../images/down.gif" /> <a href="#luahookinsertfilter">LuaHookInsertFilter</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luahooklog">LuaHookLog</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luahookmaptostorage">LuaHookMapToStorage</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#luahookpretranslate">LuaHookPreTranslate</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luahooktranslatename">LuaHookTranslateName</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luahooktypechecker">LuaHookTypeChecker</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#luainherit">LuaInherit</a></li> @@ -255,31 +256,38 @@ performing access control, or setting mime types:</p> been mapped to a host or virtual host</td> </tr> <tr class="odd"> + <td>Pre-Translate name</td> + <td><code class="directive"><a href="#luahookpretranslatename">LuaHookPreTranslateName</a></code></td> + <td>This phase translates the requested URI into a filename on the + system, before decoding occurs. Modules such as <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> + can operate in this phase.</td> + </tr> +<tr> <td>Translate name</td> <td><code class="directive"><a href="#luahooktranslatename">LuaHookTranslateName</a></code></td> <td>This phase translates the requested URI into a filename on the system. Modules such as <code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code> and <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> operate in this phase.</td> </tr> -<tr> +<tr class="odd"> <td>Map to storage</td> <td><code class="directive"><a href="#luahookmaptostorage">LuaHookMapToStorage</a></code></td> <td>This phase maps files to their physical, cached or external/proxied storage. It can be used by proxy or caching modules</td> </tr> -<tr class="odd"> +<tr> <td>Check Access</td> <td><code class="directive"><a href="#luahookaccesschecker">LuaHookAccessChecker</a></code></td> <td>This phase checks whether a client has access to a resource. This phase is run before the user is authenticated, so beware. </td> </tr> -<tr> +<tr class="odd"> <td>Check User ID</td> <td><code class="directive"><a href="#luahookcheckuserid">LuaHookCheckUserID</a></code></td> <td>This phase it used to check the negotiated user ID</td> </tr> -<tr class="odd"> +<tr> <td>Check Authorization</td> <td><code class="directive"><a href="#luahookauthchecker">LuaHookAuthChecker</a></code> or <code class="directive"><a href="#luaauthzprovider">LuaAuthzProvider</a></code></td> @@ -287,25 +295,25 @@ performing access control, or setting mime types:</p> user ID, client certificate etc. </td> </tr> -<tr> +<tr class="odd"> <td>Check Type</td> <td><code class="directive"><a href="#luahooktypechecker">LuaHookTypeChecker</a></code></td> <td>This phase checks the requested file and assigns a content type and a handler to it</td> </tr> -<tr class="odd"> +<tr> <td>Fixups</td> <td><code class="directive"><a href="#luahookfixups">LuaHookFixups</a></code></td> <td>This is the final "fix anything" phase before the content handlers are run. Any last-minute changes to the request should be made here.</td> </tr> -<tr> +<tr class="odd"> <td>Content handler</td> <td>fx. <code>.lua</code> files or through <code class="directive"><a href="#luamaphandler">LuaMapHandler</a></code></td> <td>This is where the content is handled. Files are read, parsed, some are run, and the result is sent to the client</td> </tr> -<tr class="odd"> +<tr> <td>Logging</td> <td><code class="directive"><a href="#luahooklog">LuaHookLog</a></code></td> <td>Once a request has been handled, it enters several logging phases, @@ -467,14 +475,14 @@ end</pre> <td>table</td> <td>no</td> <td>MIME header environment for the response, printed even on errors and - persist across internal redirects</td> + persist across internal redirects. A read-only lua table suitable for iteration is available as r:err_headers_out_table().</td> </tr> <tr> <td><code>filename</code></td> <td>string</td> <td>yes</td> <td>The file name that the request maps to, f.x. /www/example.com/foo.txt. This can be - changed in the translate-name or map-to-storage phases of a request to allow the + changed in the pre-translate-name, translate-name or map-to-storage phases of a request to allow the default handler (or script handlers) to serve a different file than what was requested.</td> </tr> <tr class="odd"> @@ -493,13 +501,13 @@ end</pre> <td>table</td> <td>yes</td> <td>MIME header environment from the request. This contains headers such as <code>Host, - User-Agent, Referer</code> and so on.</td> + User-Agent, Referer</code> and so on. A read-only lua table suitable for iteration is available as r:headers_in_table().</td> </tr> <tr class="odd"> <td><code>headers_out</code></td> <td>table</td> <td>yes</td> - <td>MIME header environment for the response.</td> + <td>MIME header environment for the response. A read-only lua table suitable for iteration is available as r:headers_out_table().</td> </tr> <tr> <td><code>hostname</code></td> @@ -541,7 +549,7 @@ end</pre> <td><code>notes</code></td> <td>table</td> <td>yes</td> - <td>A list of notes that can be passed on from one module to another.</td> + <td>A list of notes that can be passed on from one module to another. A read-only lua table suitable for iteration is available as r:notes_table().</td> </tr> <tr class="odd"> <td><code>options</code></td> @@ -572,7 +580,7 @@ end</pre> <td>string</td> <td>yes</td> <td>Denotes whether this is a proxy request or not. This value is generally set in - the post_read_request/translate_name phase of a request.</td> + the post_read_request/pre_translate_name/translate_name phase of a request.</td> </tr> <tr> <td><code>range</code></td> @@ -608,7 +616,7 @@ end</pre> <td><code>subprocess_env</code></td> <td>table</td> <td>yes</td> - <td>The environment variables set for this request.</td> + <td>The environment variables set for this request. A read-only lua table suitable for iteration is available as r:subprocess_env_table().</td> </tr> <tr> <td><code>started</code></td> @@ -1052,7 +1060,7 @@ r:emerg("This is an emerg log message")</pre> <pre class="prettyprint lang-lua">function filter(r) -- Our first yield is to signal that we are ready to receive buckets. -- Before this yield, we can set up our environment, check for conditions, - -- and, if we deem it necessary, decline filtering a request alltogether: + -- and, if we deem it necessary, decline filtering a request altogether: if something_bad then return -- This would skip this filter. end @@ -1084,7 +1092,14 @@ end</pre> <p> Mod_lua implements a simple database feature for querying and running commands on the most popular database engines (mySQL, PostgreSQL, FreeTDS, ODBC, SQLite, Oracle) - as well as mod_dbd. + as well as mod_dbd.</p> + <p> + The <code>dbType</code> to use as the first parameter of <code>dbacquire</code> + is case sensitive.</p> + <p> + It should be one of <code>mysql</code>, <code>pgsql</code>, <code>freetds</code>, + <code>odbc</code>, <code>sqlite2</code>, <code>sqlite3</code>, <code>oracle</code> + or <code>mod_dbd</code>. </p> <p>The example below shows how to acquire a database handle and return information from a table:</p> <pre class="prettyprint lang-lua">function handle(r) @@ -1457,7 +1472,7 @@ end</pre> <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_lua</td></tr> </table> <p>Like <code class="directive">LuaHookTranslateName</code> but executed at the - map-to-storage phase of a request. Modules like mod_cache run at this phase, + map-to-storage phase of a request. Modules like <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> run at this phase, which makes for an interesting example on what to do here:</p> <pre class="prettyprint lang-config">LuaHookMapToStorage "/path/to/lua/script.lua" check_cache</pre> @@ -1495,6 +1510,23 @@ end</pre> </div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="LuaHookPreTranslate" id="LuaHookPreTranslate">LuaHookPreTranslate</a> <a name="luahookpretranslate" id="luahookpretranslate">Directive</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Provide a hook for the pre_translate phase of a request +processing</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LuaHookPreTranslate /path/to/lua/script.lua hook_function_name</code></td></tr> +<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr> +<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr> +<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_lua</td></tr> +</table> +<p> + Just like LuaHookTranslateName, but executed at the pre_translate phase, + where the URI-path is not percent decoded. +</p> + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="directive-section"><h2><a name="LuaHookTranslateName" id="LuaHookTranslateName">LuaHookTranslateName</a> <a name="luahooktranslatename" id="luahooktranslatename">Directive</a></h2> <table class="directive"> <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Provide a hook for the translate name phase of request processing</td></tr> @@ -1785,7 +1817,7 @@ LuaPackagePath "/scripts/lib/?/init.lua"</pre> <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_lua</td></tr> </table> <p> - This phase is run immediately after the request has been mapped to a virtal host, + This phase is run immediately after the request has been mapped to a virtual host, and can be used to either do some request processing before the other phases kick in, or to serve a request without the need to translate, map to storage et cetera. As this phase is run before anything else, directives such as <code class="directive"><a href="../mod/core.html#location"><Location></a></code> or <code class="directive"><a href="../mod/core.html#directory"><Directory></a></code> are void in this phase, just as @@ -1862,8 +1894,8 @@ LuaPackagePath "/scripts/lib/?/init.lua"</pre> </div> <div class="bottomlang"> <p><span>Available Languages: </span><a href="../en/mod/mod_lua.html" title="English"> en </a> | -<a href="../fr/mod/mod_lua.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> -</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> +<a href="../fr/mod/mod_lua.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> +</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our <a href="https://httpd.apache.org/lists.html">mailing lists</a>.</div> <script type="text/javascript"><!--//--><![CDATA[//><!-- var comments_shortname = 'httpd'; var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_lua.html'; @@ -1881,7 +1913,7 @@ var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_lua.html'; } })(window, document); //--><!]]></script></div><div id="footer"> -<p class="apache">Copyright 2019 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> +<p class="apache">Copyright 2024 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- if (typeof(prettyPrint) !== 'undefined') { prettyPrint(); |