mod_lua.xml revision 2219c51bf0756c2f6f7deb88a13baf30f141c12e
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen<?xml version="1.0"?>
fb51a6b789d85113d0976148685b0063c294220drbowen<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
77a0265761f1bec2aaa0b4116c644f8066e349e3rbowen<!-- $LastChangedRevision$ -->
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen<!--
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen Licensed to the Apache Software Foundation (ASF) under one or more
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen contributor license agreements. See the NOTICE file distributed with
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen this work for additional information regarding copyright ownership.
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen The ASF licenses this file to You under the Apache License, Version 2.0
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen (the "License"); you may not use this file except in compliance with
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen the License. You may obtain a copy of the License at
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen http://www.apache.org/licenses/LICENSE-2.0
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen Unless required by applicable law or agreed to in writing, software
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen distributed under the License is distributed on an "AS IS" BASIS,
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen See the License for the specific language governing permissions and
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen limitations under the License.
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen-->
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen
b07b82e44c32825d6226ee801d2ed91555e593d1rbowen<modulesynopsis metafile="mod_lua.xml.meta">
fb51a6b789d85113d0976148685b0063c294220drbowen
fb51a6b789d85113d0976148685b0063c294220drbowen<name>mod_lua</name>
fb51a6b789d85113d0976148685b0063c294220drbowen
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowen<description>Provides Lua hooks into various portions of the httpd
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowenrequest processing</description>
b75b4bfd9e8ec9fbf28a95174dc0e4d420f744a8sf<status>experimental</status>
fb51a6b789d85113d0976148685b0063c294220drbowen<sourcefile>mod_lua.c</sourcefile>
fb51a6b789d85113d0976148685b0063c294220drbowen<identifier>lua_module</identifier>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<compatibility>2.4 and later</compatibility>
fb51a6b789d85113d0976148685b0063c294220drbowen
fb51a6b789d85113d0976148685b0063c294220drbowen<summary>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim<p>Someone needs to write this.</p>
889dc1728817c1c56d0c8d894c768614e346d86ecovener
889dc1728817c1c56d0c8d894c768614e346d86ecovener</summary>
889dc1728817c1c56d0c8d894c768614e346d86ecovener
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim<section id="basicconf"><title>Basic Configuration</title>
889dc1728817c1c56d0c8d894c768614e346d86ecovener
889dc1728817c1c56d0c8d894c768614e346d86ecovener<p>The basic module loading directive is</p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
889dc1728817c1c56d0c8d894c768614e346d86ecovener<example>
fb51a6b789d85113d0976148685b0063c294220drbowen LoadModule lua_module modules/mod_lua.so
8548ace6aa09b4d3e463254b53865fb38fbbbc78poirier</example>
8548ace6aa09b4d3e463254b53865fb38fbbbc78poirier
8548ace6aa09b4d3e463254b53865fb38fbbbc78poirier<p>
8548ace6aa09b4d3e463254b53865fb38fbbbc78poirier<code>mod_lua</code> provides a handler named <code>lua-script</code>,
fb51a6b789d85113d0976148685b0063c294220drbowenwhich can be used with an <code>AddHandler</code> directive:</p>
fb51a6b789d85113d0976148685b0063c294220drbowen
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowen<example>
fb51a6b789d85113d0976148685b0063c294220drbowenAddHandler lua-script .lua
3e30fa5f420fe7302a4cdcd79cb001958fd54a13rbowen</example>
fb51a6b789d85113d0976148685b0063c294220drbowen
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowen<p>
2219c51bf0756c2f6f7deb88a13baf30f141c12epoirierThis will cause any <code>.lua</code> file to be evaluated by
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowen<code>mod_lua</code>.
fb51a6b789d85113d0976148685b0063c294220drbowen</p>
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowen</section>
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowen
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowen<section id="writinghandlers"><title>Writing Handlers</title>
fb51a6b789d85113d0976148685b0063c294220drbowen
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowen<p><code>mod_lua</code> always looks to invoke a function for the handler, rather than
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowenjust evaluating a script body CGI style. A handler function looks
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowensomething like this:</p>
fb51a6b789d85113d0976148685b0063c294220drbowen
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowen<example><title>example.lua</title><pre>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier require "string"
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier function handle_something(r)
4b2d52ed83bf31730c8b6bbe7c06d806dc3a0c4erbowen r.content_type = "text/plain"
92e5d4326ae44f79da5cb049470daba604506846poirier r:puts("Hello Lua World!\n")
92e5d4326ae44f79da5cb049470daba604506846poirier
92e5d4326ae44f79da5cb049470daba604506846poirier if r.method == 'GET' then
92e5d4326ae44f79da5cb049470daba604506846poirier for k, v in pairs( r:parseargs() ) do
fb51a6b789d85113d0976148685b0063c294220drbowen r:puts( string.format("%s: %s", k, v) )
fb51a6b789d85113d0976148685b0063c294220drbowen end
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen elseif r.method == 'POST' then
889dc1728817c1c56d0c8d894c768614e346d86ecovener for k, v in pairs( r:parsebody() ) do
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim r:puts( string.format("%s: %s", k, v) )
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim end
889dc1728817c1c56d0c8d894c768614e346d86ecovener else
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen r:puts("unknown HTTP method " .. r.method)
889dc1728817c1c56d0c8d894c768614e346d86ecovener end
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen end
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen</pre></example>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<p>
92e5d4326ae44f79da5cb049470daba604506846poirierThis handler function just prints out the uri or form encoded
92e5d4326ae44f79da5cb049470daba604506846poirierarguments to a plaintext page.
92e5d4326ae44f79da5cb049470daba604506846poirier</p>
92e5d4326ae44f79da5cb049470daba604506846poirier
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim<p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jimThis means (and in fact encourages) that you can have multiple
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jimhandlers (or hooks, or filters) in the same script.
cf7d90693f7579700c4f7e663adb83196f903df1covener</p>
cf7d90693f7579700c4f7e663adb83196f903df1covener
cf7d90693f7579700c4f7e663adb83196f903df1covener</section>
92e5d4326ae44f79da5cb049470daba604506846poirier
92e5d4326ae44f79da5cb049470daba604506846poirier<section id="datastructures"><title>Data Structures</title>
92e5d4326ae44f79da5cb049470daba604506846poirier
92e5d4326ae44f79da5cb049470daba604506846poirier<dl>
92e5d4326ae44f79da5cb049470daba604506846poirier<dt>request_rec</dt>
92e5d4326ae44f79da5cb049470daba604506846poirier <dd>
92e5d4326ae44f79da5cb049470daba604506846poirier <p>The request_rec is mapped in as a userdata. It has a metatable
92e5d4326ae44f79da5cb049470daba604506846poirier which lets you do useful things with it. For the most part it
92e5d4326ae44f79da5cb049470daba604506846poirier has the same fields as the request_rec struct (see httpd.h
92e5d4326ae44f79da5cb049470daba604506846poirier until we get better docs here) many of which are writeable as
92e5d4326ae44f79da5cb049470daba604506846poirier well as readable, and has (at least) the following methods:</p>
92e5d4326ae44f79da5cb049470daba604506846poirier
92e5d4326ae44f79da5cb049470daba604506846poirier <example>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim r:puts("hello", " world", "!") -- print to response body
92e5d4326ae44f79da5cb049470daba604506846poirier </example>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen </dd>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen </dl>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen</section>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<section id="logging"><title>Logging Functions</title>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<example>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen r:debug("This is a debug log message")<br />
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen r:info("This is an info log message")<br />
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen r:notice("This is an notice log message")<br />
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen r:warn("This is an warn log message")<br />
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen r:err("This is an err log message")<br />
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen r:alert("This is an alert log message")<br />
92e5d4326ae44f79da5cb049470daba604506846poirier r:crit("This is an crit log message")<br />
92e5d4326ae44f79da5cb049470daba604506846poirier r:emerg("This is an emerg log message")<br />
889dc1728817c1c56d0c8d894c768614e346d86ecovener</example>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim</section>
889dc1728817c1c56d0c8d894c768614e346d86ecovener
889dc1728817c1c56d0c8d894c768614e346d86ecovener<directivesynopsis>
889dc1728817c1c56d0c8d894c768614e346d86ecovener<name>LuaRoot</name>
92e5d4326ae44f79da5cb049470daba604506846poirier<description>Specify the base path for resolving relative paths for mod_lua directives</description>
92e5d4326ae44f79da5cb049470daba604506846poirier<syntax>LuaRoot /path/to/a/directory</syntax>
92e5d4326ae44f79da5cb049470daba604506846poirier<contextlist><context>server config</context><context>virtual host</context>
92e5d4326ae44f79da5cb049470daba604506846poirier<context>directory</context><context>.htaccess</context>
92e5d4326ae44f79da5cb049470daba604506846poirier</contextlist>
92e5d4326ae44f79da5cb049470daba604506846poirier<override>All</override>
92e5d4326ae44f79da5cb049470daba604506846poirier
bb57315f942d09c744543fe41e453bd0181fd93ecovener<usage>
bb57315f942d09c744543fe41e453bd0181fd93ecovener <p>Specify the base path which will be used to evaluate all
bb57315f942d09c744543fe41e453bd0181fd93ecovener relative paths within mod_lua. If not specified they
bb57315f942d09c744543fe41e453bd0181fd93ecovener will be resolved relative to the current working directory,
bb57315f942d09c744543fe41e453bd0181fd93ecovener which may not always work well for a server.</p>
bb57315f942d09c744543fe41e453bd0181fd93ecovener</usage>
bb57315f942d09c744543fe41e453bd0181fd93ecovener</directivesynopsis>
bb57315f942d09c744543fe41e453bd0181fd93ecovener
bb57315f942d09c744543fe41e453bd0181fd93ecovener<directivesynopsis>
bb57315f942d09c744543fe41e453bd0181fd93ecovener<name>LuaScope</name>
bb57315f942d09c744543fe41e453bd0181fd93ecovener<description>One of once, request, conn, server -- default is once</description>
bb57315f942d09c744543fe41e453bd0181fd93ecovener<syntax>LuaScope once|request|conn|server [max|min max]</syntax>
bb57315f942d09c744543fe41e453bd0181fd93ecovener<contextlist><context>server config</context><context>virtual host</context>
bb57315f942d09c744543fe41e453bd0181fd93ecovener<context>directory</context><context>.htaccess</context>
bb57315f942d09c744543fe41e453bd0181fd93ecovener</contextlist>
bb57315f942d09c744543fe41e453bd0181fd93ecovener<override>All</override>
bb57315f942d09c744543fe41e453bd0181fd93ecovener
bb57315f942d09c744543fe41e453bd0181fd93ecovener<usage>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim <p>Specify the lifecycle scope of the Lua interpreter which will
bb57315f942d09c744543fe41e453bd0181fd93ecovener be used by handlers in this "Directory." The default is "once"</p>
bb57315f942d09c744543fe41e453bd0181fd93ecovener
8e9a311b466b8a3d2782af71a432a6a7ee2cd2f0covener <dl>
bb57315f942d09c744543fe41e453bd0181fd93ecovener <dt>once:</dt> <dd>use the interpreter once and throw it away.</dd>
92e5d4326ae44f79da5cb049470daba604506846poirier
92e5d4326ae44f79da5cb049470daba604506846poirier <dt>request:</dt> <dd>use the interpreter to handle anything based on
92e5d4326ae44f79da5cb049470daba604506846poirier the same file within this request, which is also
92e5d4326ae44f79da5cb049470daba604506846poirier request scoped.</dd>
92e5d4326ae44f79da5cb049470daba604506846poirier
92e5d4326ae44f79da5cb049470daba604506846poirier <dt>conn:</dt> <dd>Same as request but attached to the connection_rec</dd>
92e5d4326ae44f79da5cb049470daba604506846poirier
92e5d4326ae44f79da5cb049470daba604506846poirier <dt>server:</dt> <dd>This one is different than others because the
92e5d4326ae44f79da5cb049470daba604506846poirier server scope is quite long lived, and multiple threads
92e5d4326ae44f79da5cb049470daba604506846poirier will have the same server_rec. To accommodate this
92e5d4326ae44f79da5cb049470daba604506846poirier server scoped interpreter are stored in an apr
92e5d4326ae44f79da5cb049470daba604506846poirier resource list. The min and max arguments are intended
92e5d4326ae44f79da5cb049470daba604506846poirier to specify the pool size, but are unused at this time.</dd>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen </dl>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen</usage>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen</directivesynopsis>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<directivesynopsis>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<name>LuaMapHandler</name>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<description>Map a path to a lua handler</description>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim<syntax>LuaMapHandler uri-pattern /path/to/lua/script.lua [function-name]</syntax>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<contextlist><context>server config</context><context>virtual host</context>
92e5d4326ae44f79da5cb049470daba604506846poirier<context>directory</context><context>.htaccess</context>
92e5d4326ae44f79da5cb049470daba604506846poirier</contextlist>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<override>All</override>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<usage>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <p>This directive matches a uri pattern to invoke a specific
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier handler function in a specific file. It uses PCRE regular
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier expressions to match the uri, and supports interpolating
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier match groups into both the file path and the function name
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier be careful writing your regular expressions to avoid security
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier issues.</p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <example><title>Examples:</title>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier LuaMapHandler /(\w+)/(/w+) /scripts/$1.lua handle_$2
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier </example>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <p>This would match uri's such as /photos/show?id=9
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier to the file /scripts/photos.lua and invoke the
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier handler function handle_show on the lua vm after
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier loading that file.</p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
fc57cc74ee4e73618f74a7a62ea6ac77546666dacovener<example>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier LuaMapHandler /bingo /scripts/wombat.lua
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</example>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <p>This would invoke the "handle" function, which
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier is the default if no specific function name is
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier provided.</p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</usage>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<name>LuaPackagePath</name>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<description>Add a directory to lua's package.path</description>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<syntax>LuaPackagePath /path/to/include/?.lua</syntax>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<contextlist><context>server config</context><context>virtual host</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<context>directory</context><context>.htaccess</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</contextlist>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<override>All</override>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <usage><p>Add a path to lua's module search path. Follows the same
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier conventions as lua. This just munges the package.path in the
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier lua vms.</p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <example><title>Examples:</title>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier LuaPackagePath /scripts/lib/?.lua<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier LuaPackagePath /scripts/lib/?/init.lua
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier </example>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</usage>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<name>LuaPackageCPath</name>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<description>Add a directory to lua's package.cpath</description>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<syntax>LuaPackageCPath /path/to/include/?.soa</syntax>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<contextlist><context>server config</context><context>virtual host</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<context>directory</context><context>.htaccess</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</contextlist>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<override>All</override>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<usage>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <p>Add a path to lua's shared library search path. Follows the same
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener conventions as lua. This just munges the package.cpath in the
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener lua vms.</p>
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener</usage>
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener</directivesynopsis>
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<name>LuaCodeCache</name>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<description>Configure the compiled code cache.</description>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<syntax>LuaCodeCache stat|forever|never</syntax>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<contextlist><context>server config</context><context>virtual host</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<context>directory</context><context>.htaccess</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</contextlist>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<override>All</override>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<usage><p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier Specify the behavior of the in-memory code cache. The default
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier is stat, which stats the top level script (not any included
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier ones) each time that file is needed, and reloads it if the
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier modified time indicates it is newer than the one it has
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier already loaded. The other values cause it to keep the file
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier cached forever (don't stat and replace) or to never cache the
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier file.</p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <p>In general stat or forever is good production and stat or never
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier for deveopment.</p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <example><title>Examples:</title>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier LuaCodeCache stat<br />
92e5d4326ae44f79da5cb049470daba604506846poirier LuaCodeCache forever<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier LuaCodeCache never<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier </example>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</usage>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<name>LuaHookTranslateName</name>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<description>Provide a hook for the translate name phase of request processing</description>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<syntax>LuaHookTranslateName /path/to/lua/script.lua hook_function_name</syntax>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<contextlist><context>server config</context><context>virtual host</context>
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener<context>directory</context><context>.htaccess</context>
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener</contextlist>
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener<override>All</override>
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener<usage><p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier Add a hook (at APR_HOOK_MIDDLE) to the translate name phase of
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier request processing. The hook function receives a single
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier argument, the request_rec, and should return a status code,
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier which is either an HTTP error code, or the constants defined
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier in the apache2 module: apache2.OK, apache2.DECLINED, or
8230057b2a5c382433ec1d7a9d1e3f1bb1daa87acovener apache2.DONE. </p>
8230057b2a5c382433ec1d7a9d1e3f1bb1daa87acovener
8230057b2a5c382433ec1d7a9d1e3f1bb1daa87acovener <p>For those new to hooks, basically each hook will be invoked
8230057b2a5c382433ec1d7a9d1e3f1bb1daa87acovener until one of them returns apache2.OK. If your hook doesn't
8230057b2a5c382433ec1d7a9d1e3f1bb1daa87acovener want to do the translation it should just return
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier apache2.DECLINED. If the request should stop processing, then
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier return apache2.DONE.</p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <p>Example:</p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <example>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier LuaHookTranslateName /scripts/conf/hooks.lua silly_mapper<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier -- /scripts/conf/hooks.lua --<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier function silly_mapper(r)<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier if r.uri == "/" then<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier r.file = "/var/www/home.lua"<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier return apache2.OK<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier else<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier return apache2.DECLINED<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier end<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier end<br />
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</example>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</usage>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<name>LuaHookFixups</name>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<description>Provide a hook for the fixups phase of request
249cc9b3d83d3c60666269b90ecb9f1390d32165poirierprocessing</description>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<syntax>LuaHookFixups /path/to/lua/script.lua hook_function_name</syntax>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<contextlist><context>server config</context><context>virtual host</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<context>directory</context><context>.htaccess</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</contextlist>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<override>All</override>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<usage>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim Just like LuaHookTranslateName, but executed at the fixups phase
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</p>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</usage>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<name>LuaHookMapToStorage</name>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<description>Provide a hook for the map_to_storage phase of request processing</description>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<syntax>LuaHookMapToStorage /path/to/lua/script.lua hook_function_name</syntax>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<contextlist><context>server config</context><context>virtual host</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<context>directory</context><context>.htaccess</context>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen</contextlist>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<override>All</override>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen <usage><p>...</p></usage>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<name>LuaHookCheckUserID</name>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<description>Provide a hook for the check_user_id phase of request processing</description>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<syntax>LuaHookCheckUserID /path/to/lua/script.lua hook_function_name</syntax>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim<contextlist><context>server config</context><context>virtual host</context>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<context>directory</context><context>.htaccess</context>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen</contextlist>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<override>All</override>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen <usage><p>...</p></usage>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen</directivesynopsis>
92e5d4326ae44f79da5cb049470daba604506846poirier
b60ba9fb00026d3dbca744c6c19afe63cba3a3d1covener<directivesynopsis>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<name>LuaHookTypeChecker</name>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<description>Provide a hook for the type_checker phase of request processing</description>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<syntax>LuaHookTypeChecker /path/to/lua/script.lua hook_function_name</syntax>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<contextlist><context>server config</context><context>virtual host</context>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<context>directory</context><context>.htaccess</context>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen</contextlist>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<override>All</override>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen <usage><p>...</p></usage>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen</directivesynopsis>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<directivesynopsis>
e27eee5caa6c1bf3853c11253ae82303cff0e40brbowen<name>LuaHookAuthChecker</name>
92e5d4326ae44f79da5cb049470daba604506846poirier<description>Provide a hook for the auth_checker phase of request processing</description>
92e5d4326ae44f79da5cb049470daba604506846poirier<syntax>LuaHookAuthChecker /path/to/lua/script.lua hook_function_name</syntax>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<contextlist><context>server config</context><context>virtual host</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<context>directory</context><context>.htaccess</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</contextlist>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<override>All</override>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <usage><p>...</p></usage>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<name>LuaHookAccessChecker</name>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<description>Provide a hook for the access_checker phase of request processing</description>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<syntax>LuaHookAccessChecker /path/to/lua/script.lua hook_function_name</syntax>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<contextlist><context>server config</context><context>virtual host</context>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<context>directory</context><context>.htaccess</context>
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener</contextlist>
7152f5d04e3782c5e93016ae2ccd960f8538b83bcovener<override>All</override>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier <usage><p>...</p></usage>
92e5d4326ae44f79da5cb049470daba604506846poirier</directivesynopsis>
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier<directivesynopsis>
fb51a6b789d85113d0976148685b0063c294220drbowen<name>LuaHookInsertFilter</name>
fb51a6b789d85113d0976148685b0063c294220drbowen<description>Provide a hook for the insert_filter phase of request processing</description>
6b4cd1f143d5d7244d2476d1e28456212faddb72rbowen<syntax>LuaHookInsertFilter /path/to/lua/script.lua hook_function_name</syntax>
fb51a6b789d85113d0976148685b0063c294220drbowen<contextlist><context>server config</context><context>virtual host</context>
99e316bc4b9b2b5754165939ac14b6d16132cce1igalic<context>directory</context><context>.htaccess</context>
99e316bc4b9b2b5754165939ac14b6d16132cce1igalic</contextlist>
99e316bc4b9b2b5754165939ac14b6d16132cce1igalic<override>All</override>
99e316bc4b9b2b5754165939ac14b6d16132cce1igalic <usage><p>Not Yet Implemented</p></usage>
fb51a6b789d85113d0976148685b0063c294220drbowen</directivesynopsis>
fb51a6b789d85113d0976148685b0063c294220drbowen
fb51a6b789d85113d0976148685b0063c294220drbowen<directivesynopsis>
2219c51bf0756c2f6f7deb88a13baf30f141c12epoirier<name>LuaQuickHandler</name>
fb51a6b789d85113d0976148685b0063c294220drbowen<description>Provide a hook for the quick handler of request processing</description>
fb51a6b789d85113d0976148685b0063c294220drbowen<syntax></syntax>
fb51a6b789d85113d0976148685b0063c294220drbowen<contextlist><context>server config</context><context>virtual host</context>
fb51a6b789d85113d0976148685b0063c294220drbowen<context>directory</context><context>.htaccess</context>
fb51a6b789d85113d0976148685b0063c294220drbowen</contextlist>
fb51a6b789d85113d0976148685b0063c294220drbowen<override>All</override>
fb51a6b789d85113d0976148685b0063c294220drbowen<usage><p>...</p></usage>
6b4cd1f143d5d7244d2476d1e28456212faddb72rbowen</directivesynopsis>
fb51a6b789d85113d0976148685b0063c294220drbowen
249cc9b3d83d3c60666269b90ecb9f1390d32165poirier</modulesynopsis>
99e316bc4b9b2b5754165939ac14b6d16132cce1igalic
99e316bc4b9b2b5754165939ac14b6d16132cce1igalic