From: Daniel Gruno Date: Wed, 25 Apr 2012 07:36:17 +0000 (+0000) Subject: Highlight Lua source code X-Git-Tag: 2.5.0-alpha~7052 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f118da1ae9d3a19c0ed86d550c8cbe8d7c13133;p=thirdparty%2Fapache%2Fhttpd.git Highlight Lua source code git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1330137 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_lua.html.en b/docs/manual/mod/mod_lua.html.en index 6ec674f2d26..16d82e332cd 100644 --- a/docs/manual/mod/mod_lua.html.en +++ b/docs/manual/mod/mod_lua.html.en @@ -118,7 +118,9 @@ and mod_status. just evaluating a script body CGI style. A handler function looks something like this:

-

example.lua

+
+
+example.lua
 -- example handler
 
 require "string"
@@ -144,7 +146,8 @@ function handle(r)
         r:puts("unknown HTTP method " .. r.method)
     end
 end
-
+ +

This handler function just prints out the uri or form encoded @@ -172,7 +175,8 @@ they'll return OK, DONE, or DECLINED, which you can write in lua as apache2.OK, apache2.DONE, or apache2.DECLINED, or else an HTTP status code.

-

translate_name.lua

+
+translate_name.lua
 -- example hook that rewrites the URI to a filesystem path.
 
 require 'apache2'
@@ -185,9 +189,11 @@ function translate_name(r)
     -- we don't care about this URL, give another module a chance
     return apache2.DECLINED
 end
-
+ -

translate_name2.lua

+
+
+translate_name2.lua
 --[[ 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
@@ -206,7 +212,8 @@ function translate_name(r)
     end
     return apache2.DECLINED
 end
-
+ +
top

Data Structures

@@ -388,7 +395,7 @@ end

Logging Functions

-

+

         -- examples of logging messages
r:trace1("This is a trace log message") -- trace1 through trace8 can be used
r:debug("This is a debug log message")
@@ -399,7 +406,8 @@ end r:alert("This is an alert log message")
r:crit("This is an crit log message")
r:emerg("This is an emerg log message")
-

+ +
top
@@ -485,7 +493,7 @@ hook function usually returns OK, DECLINED, or HTTP_FORBIDDEN.

a request. This can be used to implement arbitrary authentication and authorization checking. A very simple example:

-
+
 require 'apache2'
 
 -- fake authcheck hook
@@ -516,7 +524,8 @@ function authcheck_hook(r)
    end
    return apache2.OK
 end
-
+ +

Ordering

The optional arguments "early" or "late" control when this script runs relative to other modules.

@@ -603,7 +612,9 @@ processing
 # httpd.conf
 LuaHookTranslateName /scripts/conf/hooks.lua silly_mapper
+
+
 -- /scripts/conf/hooks.lua --
 require "apache2"
 function silly_mapper(r)
@@ -614,7 +625,8 @@ function silly_mapper(r)
         return apache2.DECLINED
     end
 end
-
+ +

Context

This directive is not valid in <Directory>, <Files>, or htaccess context.

diff --git a/docs/manual/mod/mod_lua.xml b/docs/manual/mod/mod_lua.xml index 0c51337d8d5..56fdd3adec2 100644 --- a/docs/manual/mod/mod_lua.xml +++ b/docs/manual/mod/mod_lua.xml @@ -86,7 +86,9 @@ and mod_status.

just evaluating a script body CGI style. A handler function looks something like this:

-example.lua
+
+
+example.lua
 -- example handler
 
 require "string"
@@ -112,7 +114,7 @@ function handle(r)
         r:puts("unknown HTTP method " .. r.method)
     end
 end
-
+

This handler function just prints out the uri or form encoded @@ -140,7 +142,8 @@ they'll return OK, DONE, or DECLINED, which you can write in lua as apache2.OK, apache2.DONE, or apache2.DECLINED, or else an HTTP status code.

-translate_name.lua
+
+translate_name.lua
 -- example hook that rewrites the URI to a filesystem path.
 
 require 'apache2'
@@ -153,9 +156,10 @@ function translate_name(r)
     -- we don't care about this URL, give another module a chance
     return apache2.DECLINED
 end
-
+ -translate_name2.lua
+
+translate_name2.lua
 --[[ 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
@@ -174,7 +178,7 @@ function translate_name(r)
     end
     return apache2.DECLINED
 end
-
+
Data Structures @@ -356,7 +360,7 @@ end
Logging Functions - + -- examples of logging messages
r:trace1("This is a trace log message") -- trace1 through trace8 can be used
r:debug("This is a debug log message")
@@ -367,7 +371,7 @@ end r:alert("This is an alert log message")
r:crit("This is an crit log message")
r:emerg("This is an emerg log message")
-
+
@@ -570,7 +574,9 @@ end
 # httpd.conf
 LuaHookTranslateName /scripts/conf/hooks.lua silly_mapper
+
+ -- /scripts/conf/hooks.lua -- require "apache2" function silly_mapper(r) @@ -581,7 +587,7 @@ function silly_mapper(r) return apache2.DECLINED end end - + Context

This directive is not valid in Directory, a request. This can be used to implement arbitrary authentication and authorization checking. A very simple example:

-
+
 require 'apache2'
 
 -- fake authcheck hook
@@ -692,7 +698,7 @@ function authcheck_hook(r)
    end
    return apache2.OK
 end
-
+ Ordering

The optional arguments "early" or "late" control when this script runs relative to other modules.