Software /
code /
prosody
Changeset
4737:7b9e2a8c4710
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)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 27 Apr 2012 23:12:30 +0100 |
parents | 4736:3514338c59c3 |
children | 4738:e95458712782 |
files | plugins/mod_http_errors.lua |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_http_errors.lua Fri Apr 27 23:11:23 2012 +0100 +++ b/plugins/mod_http_errors.lua Fri Apr 27 23:12:30 2012 +0100 @@ -6,7 +6,8 @@ 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 @@ 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 ()