You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2013/06/06 02:46:19 UTC

svn commit: r1490095 - /httpd/httpd/trunk/docs/manual/mod/mod_lua.xml

Author: covener
Date: Thu Jun  6 00:46:17 2013
New Revision: 1490095

URL: http://svn.apache.org/r1490095
Log:
make the example a bit more instructive about the nuances
of returning OK w/ r.status set vs. returning a HTTP error code.


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=1490095&r1=1490094&r2=1490095&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_lua.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_lua.xml Thu Jun  6 00:46:17 2013
@@ -107,18 +107,24 @@ require "string"
 --]]
 function handle(r)
     r.content_type = "text/plain"
-    r:puts("Hello Lua World!\n")
 
     if r.method == 'GET' then
+        r:puts("Hello Lua World!\n")
         for k, v in pairs( r:parseargs() ) do
             r:puts( string.format("%s: %s\n", k, v) )
         end
     elseif r.method == 'POST' then
+        r:puts("Hello Lua World!\n")
         for k, v in pairs( r:parsebody() ) do
             r:puts( string.format("%s: %s\n", k, v) )
         end
-    else
+    elseif r.method == 'PUT' then
+-- use our own Error contents
         r:puts("Unsupported HTTP method " .. r.method)
+        r.status = 405
+        return apache2.ok
+    else
+-- use the ErrorDocument
         return 501
     end
     return apache2.OK