]> granicus.if.org Git - apache/commitdiff
Add some info about what LuaHookTypeChecker could be used for (other ideas are most...
authorDaniel Gruno <humbedooh@apache.org>
Wed, 1 Aug 2012 20:13:04 +0000 (20:13 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Wed, 1 Aug 2012 20:13:04 +0000 (20:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1368232 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/mod_lua.xml

index 768531f24268b63c03eb13da3cebc62ffa9165f5..ef6270942fb2cafac3f7d52a951eec27a026674a 100644 (file)
@@ -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>