module:set_global(); local server = require "net.http.server"; local codes = require "net.http.codes"; 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." }; [404] = { "Whatever you were looking for is not here. %"; "Where did you put it?", "It's behind you.", "Keep looking." }; [500] = { "% Check your error log for more info."; "Gremlins.", "It broke.", "Don't look at me." }; }; local messages = setmetatable(module:get_option("http_errors_messages", {}), { __index = default_messages }); local html = [[
$message
$extra
]]; html = html:gsub("%s%s+", ""); local entities = { ["<"] = "<", [">"] = ">", ["&"] = "&", ["'"] = "'", ["\""] = """, ["\n"] = "