summaryrefslogtreecommitdiffstats
path: root/www
diff options
context:
space:
mode:
authorNathan Angelacos <nangel@tetrasec.net>2007-10-22 20:51:36 +0000
committerNathan Angelacos <nangel@tetrasec.net>2007-10-22 20:51:36 +0000
commit8041330a1c3aad4d0ecf37024b8b6aaab4e856cd (patch)
tree94ff08463594a0b503461315f3dab7bd5b70d3ae /www
parent3f3798f938a07ee124760937ddebd8434de6d4c6 (diff)
downloadacf-core-8041330a1c3aad4d0ecf37024b8b6aaab4e856cd.tar.bz2
acf-core-8041330a1c3aad4d0ecf37024b8b6aaab4e856cd.tar.xz
Remove some assumptions we are running via http
Change the check for running under http from PATH_INFO to REQUEST_METHOD git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@223 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'www')
-rwxr-xr-xwww/cgi-bin/mvc.lua22
1 files changed, 9 insertions, 13 deletions
diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua
index b677d3b..a0ca427 100755
--- a/www/cgi-bin/mvc.lua
+++ b/www/cgi-bin/mvc.lua
@@ -102,17 +102,17 @@ dispatch = function (self)
local action = controller.conf.action
-- Because of the inheritance, normally the
- -- controller.worker.action will flow up, so that EVERY
- -- worker has an "exception_handler" action. We use rawget to
- -- make sure that only controller defined actions are used.
+ -- controller.worker.action will flow up, so that all children have
+ -- actions of all parents. We sue rawget to make sure that only
+ -- controller defined actions are used on dispatch
-- If the controller or action are missing, raise an error
if ( type(rawget(controller.worker, action)) ~= "function") then
self.conf.type = "dispatch"
error (self.conf)
end
- -- run the pre_exec code
---- if type(rawget(controller.worker.mvc, "pre_exec")) == "function" then
+ -- run the (first found) pre_exec code, starting at the controller
+ -- and moving up the parents
if type(controller.worker.mvc.pre_exec) == "function" then
controller.worker.mvc.pre_exec ( controller )
end
@@ -123,7 +123,6 @@ dispatch = function (self)
-- run the post_exec code
if type(controller.worker.mvc.post_exec) == "function" then
- -- if type(controller.worker.mvc, "post_exec") == "function" then
controller.worker.mvc.post_exec ( controller )
end
@@ -234,10 +233,10 @@ parse_path_info = function( self, string )
end
--- The View resolver of last resort.
+-- The view resolver of last resort.
view_resolver = function(self)
return function()
- if ENV["PATH_INFO"] then
+ if ENV["REQUEST_METHOD"] then
io.write ("Content-type: text/plain\n\n")
end
io.write ("Your controller and application did not specify a view resolver.\n")
@@ -257,8 +256,8 @@ end
-- The exception hander of last resort
exception_handler = function (self, message )
- if ENV["PATH_INFO"] then
- print ("Content-Type: text/html\n\n<pre>")
+ if ENV["REQUEST_METHOD"] then
+ print ("Content-Type: text/plain\n\n")
end
print ("The following unhandled application error occured:\n\n")
@@ -272,7 +271,4 @@ exception_handler = function (self, message )
else
print (tostring(message))
end
- if ENV["PATH_INFO"] then
- print ("</pre>")
- end
end