httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1368232 - /httpd/httpd/trunk/docs/manual/mod/mod_lua.xml
Date Wed, 01 Aug 2012 20:13:05 GMT
Author: humbedooh
Date: Wed Aug  1 20:13:04 2012
New Revision: 1368232

URL: http://svn.apache.org/viewvc?rev=1368232&view=rev
Log:
Add some info about what LuaHookTypeChecker could be used for (other ideas are most welcome)

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=1368232&r1=1368231&r2=1368232&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_lua.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_lua.xml Wed Aug  1 20:13:04 2012
@@ -779,7 +779,27 @@ end
 <context>directory</context><context>.htaccess</context>
 </contextlist>
 <override>All</override>
-    <usage><p>...</p></usage>
+    <usage><p>
+    This directive provides a hook for the type_checker phase of the request processing.

+    This phase is where requests are assigned a content type and a handler, and thus can

+    be used to modify the type and handler based on input:
+    </p>
+    <highlight language="config">
+    LuaHookTypeChecker /path/to/lua/script.lua type_checker
+    </highlight>
+    <highlight language="lua">
+    function type_checker(r)
+        if r.uri:match("%.to_gif$") then -- match foo.png.to_gif
+            r.content_type = "image/gif" -- assign it the image/gif type
+            r.handler = "gifWizard"      -- tell the gifWizard module to handle this
+            r.filename = r.uri:gsub("%.to_gif$", "") -- fix the filename requested
+            return apache2.OK
+        end
+
+        return apache2.DECLINED
+    end
+    </highlight>
+</usage>
 </directivesynopsis>
 
 <directivesynopsis>



Mime
View raw message