diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-02-09 13:17:26 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-02-09 13:17:26 +0000 |
commit | b5026e65c0334f9d8afddb0a3ca1797ef2baff5c (patch) | |
tree | 11bbfe5c05510a9301bfb8eedfe8fc68b9b2687b /libs/web/luasrc/dispatcher.lua | |
parent | 8dbb8a0ad386fd890f688109c44df0429c2af597 (diff) |
libs/web: don't send Status: 500 in error500() if header is already sent
modules/admin-core: include template header only once
Diffstat (limited to 'libs/web/luasrc/dispatcher.lua')
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 5110209aa..538017dc7 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -74,12 +74,14 @@ end -- @param message Custom error message (optional)# -- @return false function error500(message) - luci.http.status(500, "Internal Server Error") - - require("luci.template") - if not luci.util.copcall(luci.template.render, "error500", {message=message}) then - luci.http.prepare_content("text/plain") - luci.http.write(message) + if not context.template_header_sent then + luci.http.status(500, "Internal Server Error") + else + require("luci.template") + if not luci.util.copcall(luci.template.render, "error500", {message=message}) then + luci.http.prepare_content("text/plain") + luci.http.write(message) + end end return false end @@ -589,7 +591,7 @@ end local function _call(self, ...) - if #self.argv > 0 then + if #self.argv > 0 then return getfenv()[self.name](unpack(self.argv), ...) else return getfenv()[self.name](...) |