<section id="map_handler"><title>Example 5: Overlays using LuaMapHandler</title>
<highlight language="config">
-LuaMaphandler ^/portal/([a-z]+)/ /path/to/lua/script.lua handle_$1
+LuaMapHandler ^/portal/([a-z]+)/ /path/to/lua/script.lua handle_$1
</highlight>
</section>
<br/>
<a href="#apache2.port">apache2.port</a>
<br/>
-<a href="#apache2.getenv">apache2.getenv</a>
-<br/>
-<a href="#apache2.setenv">apache2.setenv</a>
-<br/>
<a href="#apache2.options">apache2.options</a>
<br/>
<a href="#apache2.allowoverrides">apache2.allowoverrides</a>
<br/>
<a href="#apache2.add_input_filter">apache2.add_input_filter</a>
<br/>
-<a href="#apache2.add_output_filter">apache2.add_output_filter</a>
-<br/>
<a href="#apache2.get_basic_auth_pw">apache2.get_basic_auth_pw</a>
<br/>
<a href="#apache2.get_limit_req_body">apache2.get_limit_req_body</a>
<br/>
<a href="#apache2.some_auth_required">apache2.some_auth_required</a>
<br/>
-<a href="#apache2.context_document_root">apache2.context_document_root</a>
-<br/>
-<a href="#apache2.context_prefix">apache2.context_prefix</a>
-<br/>
<a href="#apache2.set_context_prefix">apache2.set_context_prefix</a>
<br/>
+<a href="#apache2.get_server_name_for_url">apache2.get_server_name_for_url</a>
+<br/>
<a href="#apache2.set_keepalive">apache2.set_keepalive</a>
<br/>
<a href="#apache2.make_etag">apache2.make_etag</a>
</highlight>
<p> </p>
</section>
-<section id="apache2.add_output_filter">
-<title>apache2.add_output_filter(
- request_rec<em> r</em>, string<em> filter</em>
- )
- </title>
-<p>
-Adds an output filter to the request
- </p>
-<p>
-<em>Arguments:</em>
-</p>
-<table border="1">
-<tr>
-<th>Argument</th>
-<th>Description</th>
-</tr>
-<tr>
-<td>r</td>
-<td>The mod_lua request handle</td>
-</tr>
-<tr>
-<td>filter</td>
-<td>The name of the filter handler to add</td>
-</tr>
-</table>
-<p>
-<em>Example:</em>
-</p>
-<highlight language="lua">
-apache2.add_input_filter(r, "INCLUDES") -- Turn out output into an SSI-enabled document.
- </highlight>
-<p> </p>
-</section>
<section id="apache2.allowoverrides">
<title>apache2.allowoverrides(
request_rec<em> r</em>
</p>
<p> </p>
</section>
-<section id="apache2.context_document_root">
-<title>apache2.context_document_root(
- request_rec<em> r</em>
- )
- </title>
-<p>
-Get the context_document_root for a request. This is a generalization of the document root, which is too limited in the presence of mappers like mod_userdir and mod_alias. The context_document_root is the directory on disk that maps to the context_prefix URI prefix.
- </p>
-<p>
-<em>Arguments:</em>
-</p>
-<table border="1">
-<tr>
-<th>Argument</th>
-<th>Description</th>
-</tr>
-<tr>
-<td>r</td>
-<td>The mod_lua request handle</td>
-</tr>
-</table>
-<p> </p>
-</section>
-<section id="apache2.context_prefix">
-<title>apache2.context_prefix(
- request_rec<em> r</em>
- )
- </title>
-<p>
-Get the context_prefix for a request. The context_prefix URI prefix maps to the context_document_root on disk.
- </p>
-<p>
-<em>Arguments:</em>
-</p>
-<table border="1">
-<tr>
-<th>Argument</th>
-<th>Description</th>
-</tr>
-<tr>
-<td>r</td>
-<td>The mod_lua request handle</td>
-</tr>
-</table>
-<p> </p>
-</section>
<section id="apache2.flush">
<title>apache2.flush(
request_rec<em> r</em>
</section>
<section id="apache2.get_server_name">
<title>apache2.get_server_name(
-
+ request_rec<em> r</em>
)
</title>
<p>
<p>
<em>Arguments:</em>
</p>
-<p>None</p>
+<table border="1">
+<tr>
+<th>Argument</th>
+<th>Description</th>
+</tr>
+<tr>
+<td>r</td>
+<td>The mod_lua request handle</td>
+</tr>
+</table>
<p>
<em>Return value(s):</em>
<br/>
</highlight>
<p> </p>
</section>
-<section id="apache2.getenv">
-<title>apache2.getenv(
- request_rec<em> r</em>, string<em> key</em>
+<section id="apache2.get_server_name_for_url">
+<title>apache2.get_server_name_for_url(
+ request_rec<em> r</em>
)
</title>
<p>
-Returns the value of an environment variable
+Get the current server name from the request for the purposes of using in a URL.
+If the server name is an IPv6 literal address, it will be returned in URL format (e.g., "[fe80::1]").
</p>
<p>
<em>Arguments:</em>
<td>r</td>
<td>The mod_lua request handle</td>
</tr>
-<tr>
-<td>key</td>
-<td>key</td>
-</tr>
</table>
-<p>
-<em>Return value(s):</em>
-<br/>
-The queried value
- </p>
-<p>
-<em>Example:</em>
-</p>
-<highlight language="lua">
-local env = apache2.getenv("HTTP_HOST")
-if env and env:len() > 0 then
- r:puts("HTTP_HOST equals ", env)
-end
- </highlight>
<p> </p>
</section>
<section id="apache2.make_etag">
</section>
<section id="apache2.requestbody">
<title>apache2.requestbody(
- request_rec<em> r</em>, string<em> filename</em>
+ request_rec<em> r</em>, number<em> size</em>, string<em> filename</em>
)
</title>
<p>
<td>The mod_lua request handle</td>
</tr>
<tr>
+<td>size</td>
+<td>The maximum size allowed, or 0/nil for unlimited size</td>
+</tr>
+<tr>
<td>filename</td>
-<td>filename</td>
+<td>The file to save the output to, or nil to return it as a string</td>
</tr>
</table>
<p>
</p>
<highlight language="lua">
if tonumber(r.headers_in['Content-Length'] or 0) < 10000 then
- local smallfile = apache2.requestbody(r) -- fetch a small file into memory
+ local smallfile = apache2.requestbody(r, 10000) -- fetch a small file into memory
r:puts("I saved the uploaded file in memory")
else
- local read = apache2.requestbody(r, "/path/to/tmp")
+ local read = apache2.requestbody(r, 0, "/path/to/tmp")
r:puts("I saved the uploaded file in a temp directory. Total bytes written was: ", read)
end
</highlight>
</p>
<p> </p>
</section>
-<section id="apache2.setenv">
-<title>apache2.setenv(
- request_rec<em> r</em>, string<em> key</em>, string<em> val</em>
- )
- </title>
-<p>
-Sets the value of an environment variable
- </p>
-<p>
-<em>Arguments:</em>
-</p>
-<table border="1">
-<tr>
-<th>Argument</th>
-<th>Description</th>
-</tr>
-<tr>
-<td>r</td>
-<td>The mod_lua request handle</td>
-</tr>
-<tr>
-<td>key</td>
-<td>key</td>
-</tr>
-<tr>
-<td>val</td>
-<td>val</td>
-</tr>
-</table>
-<p>
-<em>Example:</em>
-</p>
-<highlight language="lua">
-apache2.setenv("FOO_VAL", "bar and stuff")
- </highlight>
-<p> </p>
-</section>
<section id="apache2.some_auth_required">
<title>apache2.some_auth_required(
request_rec<em> r</em>
</p>
<highlight language="lua">
if apache2.expr("%{REQUEST_URI} =~ /force-gzip") then
- apache2.add_output_filter(r, "DEFLATE")
+ r:addoutputfilter("DEFLATE")
end
</highlight>
<p> </p>
)
</title>
<p>
-Opens up a new database connection.
+Opens up a new database connection. See the DB functions for mod_pLua for more info on this.
</p>
<p>
<em>Arguments:</em>
<p> </p>
</section>
</section>
-
</manualpage>