You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by hu...@apache.org on 2012/08/06 11:40:12 UTC
svn commit: r1369761 - /httpd/httpd/trunk/docs/manual/developer/lua.xml
Author: humbedooh
Date: Mon Aug 6 09:40:11 2012
New Revision: 1369761
URL: http://svn.apache.org/viewvc?rev=1369761&view=rev
Log:
Fix some typos, scrap some functions, change some arguments and add a new function, as per sf's email.
Modified:
httpd/httpd/trunk/docs/manual/developer/lua.xml
Modified: httpd/httpd/trunk/docs/manual/developer/lua.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/lua.xml?rev=1369761&r1=1369760&r2=1369761&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/lua.xml (original)
+++ httpd/httpd/trunk/docs/manual/developer/lua.xml Mon Aug 6 09:40:11 2012
@@ -418,7 +418,7 @@ end
<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>
@@ -818,10 +818,6 @@ print(unescaped) -- prints "This is a te
<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>
@@ -830,8 +826,6 @@ print(unescaped) -- prints "This is a te
<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>
@@ -842,12 +836,10 @@ print(unescaped) -- prints "This is a te
<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>
@@ -898,39 +890,6 @@ apache2.add_input_filter(r, "SPAM_FILTER
</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>
@@ -1024,52 +983,6 @@ The current Authorization type used in t
</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>
@@ -1165,7 +1078,7 @@ r:puts("You can't upload files bigger th
</section>
<section id="apache2.get_server_name">
<title>apache2.get_server_name(
-
+ request_rec<em>Â r</em>
)
</title>
<p>
@@ -1174,7 +1087,16 @@ Returns the current server name from the
<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/>
@@ -1189,13 +1111,14 @@ r:puts("The ServerName is set to: ", nam
</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>
@@ -1209,25 +1132,7 @@ Returns the value of an environment vari
<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">
@@ -1372,7 +1277,7 @@ end
</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>
@@ -1391,8 +1296,12 @@ Reads the request body. If a filename is
<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>
@@ -1405,10 +1314,10 @@ The number of bytes written if a filenam
</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>
@@ -1612,43 +1521,6 @@ True if keepalive can be set, false othe
</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>
@@ -1732,7 +1604,7 @@ True if the expression evaluates as true
</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>
@@ -2322,7 +2194,7 @@ Kills off a server process. This has no
)
</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>
@@ -2540,5 +2412,4 @@ r:puts("delayed")
<p>Â </p>
</section>
</section>
-
</manualpage>