diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-04-27 23:12:30 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-04-27 23:12:30 +0100 |
commit | 97bead16ac519052bbcfb3792fbc547fe0c423cb (patch) | |
tree | 597c3ef948b2c47c08bc8d9dfa55d7762c9e3e09 /plugins/mod_http_errors.lua | |
parent | e865b1b3fe06dd681f121fd0147608f47a8bfc34 (diff) | |
download | prosody-97bead16ac519052bbcfb3792fbc547fe0c423cb.tar.gz prosody-97bead16ac519052bbcfb3792fbc547fe0c423cb.zip |
mod_http_errors: Add two new config options, http_errors_always_show (show even for unknown errors) and http_errors_default_message (message for unknown errors)
Diffstat (limited to 'plugins/mod_http_errors.lua')
-rw-r--r-- | plugins/mod_http_errors.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/mod_http_errors.lua b/plugins/mod_http_errors.lua index 820bcc2f..c7bcbbc1 100644 --- a/plugins/mod_http_errors.lua +++ b/plugins/mod_http_errors.lua @@ -6,7 +6,8 @@ local codes = require "net.http.codes"; local termcolours = require "util.termcolours"; local show_private = module:get_option_boolean("http_errors_detailed", false); - +local always_serve = module:get_option_boolean("http_errors_always_show", true); +local default_message = { module:get_option_string("http_errors_default_message", "That's all I know.") }; local default_messages = { [400] = { "What kind of request do you call that??" }; [403] = { "You're not allowed to do that." }; @@ -59,7 +60,8 @@ end local function get_page(code, extra) local message = messages[code]; - if message then + if always_serve or message then + message = message or default_message; return (html:gsub("$(%a+)", { title = rawget(codes, code) or ("Code "..tostring(code)); message = message[1]:gsub("%%", function () |