From: Daniel Gruno Date: Wed, 1 Aug 2012 20:13:04 +0000 (+0000) Subject: Add some info about what LuaHookTypeChecker could be used for (other ideas are most... X-Git-Tag: 2.5.0-alpha~6535 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9767564418132be5802a4c71917253ed77a7b1d;p=thirdparty%2Fapache%2Fhttpd.git Add some info about what LuaHookTypeChecker could be used for (other ideas are most welcome) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1368232 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_lua.xml b/docs/manual/mod/mod_lua.xml index 768531f2426..ef6270942fb 100644 --- a/docs/manual/mod/mod_lua.xml +++ b/docs/manual/mod/mod_lua.xml @@ -779,7 +779,27 @@ end directory.htaccess All -

...

+

+ 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: +

+ + LuaHookTypeChecker /path/to/lua/script.lua type_checker + + + 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 + +