httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1154277 - /httpd/httpd/trunk/docs/manual/mod/mod_lua.xml
Date Fri, 05 Aug 2011 15:52:33 GMT
Author: covener
Date: Fri Aug  5 15:52:33 2011
New Revision: 1154277

URL: http://svn.apache.org/viewvc?rev=1154277&view=rev
Log:
explain some of the mystery quirks of the translate_name example, and introduce
one that does a more basic URI->filename.


Modified:
    httpd/httpd/trunk/docs/manual/mod/mod_lua.xml

Modified: httpd/httpd/trunk/docs/manual/mod/mod_lua.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_lua.xml?rev=1154277&r1=1154276&r2=1154277&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_lua.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_lua.xml Fri Aug  5 15:52:33 2011
@@ -140,7 +140,29 @@ they'll return OK, DONE, or DECLINED, wh
 <code>apache2.DECLINED</code>, or else an HTTP status code.</p>
 
 <example><title>translate_name.lua</title><pre>
--- example hook
+-- example hook that rewrites the URI to a filesystem path.
+
+require 'apache2'
+
+function translate_name(r)
+    if r.uri == "/translate-name" then
+        r.filename = r.document_root .. "/find_me.txt"
+        return apache2.OK
+    end
+    -- we don't care about this URL, give another module a chance
+    return apache2.DECLINED
+end
+</pre></example>
+
+<example><title>translate_name2.lua</title><pre>
+--[[ example hook that rewrites one URI to another URI. It returns a
+     apache2.DECLINED to give other URL mappers a chance to work on the
+     substitution, including the core translate_name hook which maps based
+     on the DocumentRoot.  
+
+     Note: It is currently undefined as to whether this runs before or after
+     mod_alias or any other module implementing the same hook.
+--]]
 
 require 'apache2'
 



Mime
View raw message