aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-02-25 13:12:07 +0100
committerKim Alvefur <zash@zash.se>2021-02-25 13:12:07 +0100
commitfcaf27fc8abded1ef0c3ea2a6302d25749013837 (patch)
treed58fba0f6337a109a5124e8cc9b9aa5fcd9ff930 /plugins
parent3180f48bc582fe8d48c8e5000e34c1934f6a7995 (diff)
downloadprosody-fcaf27fc8abded1ef0c3ea2a6302d25749013837.tar.gz
prosody-fcaf27fc8abded1ef0c3ea2a6302d25749013837.zip
mod_http_errors: Add some comments
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_http_errors.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/mod_http_errors.lua b/plugins/mod_http_errors.lua
index be07a43b..637c894b 100644
--- a/plugins/mod_http_errors.lua
+++ b/plugins/mod_http_errors.lua
@@ -69,6 +69,7 @@ local function get_page(code, extra)
end
end
+-- Main error page handler
module:hook_object_event(server, "http-error", function (event)
if event.response then
event.response.headers.content_type = "text/html; charset=utf-8";
@@ -76,6 +77,7 @@ module:hook_object_event(server, "http-error", function (event)
return get_page(event.code, (show_private and event.private_message) or event.message or (event.error and event.error.text));
end);
+-- Way to use the template for other things so to give a consistent appearance
module:hook("http-message", function (event)
if event.response then
event.response.headers.content_type = "text/html; charset=utf-8";
@@ -83,6 +85,7 @@ module:hook("http-message", function (event)
return render(html, event);
end);
+-- Something nicer shown instead of 404 at the root path, if nothing else handles this path
module:hook_object_event(server, "http-error", function (event)
local request, response = event.request, event.response;
if request and response and request.path == "/" and response.status_code == 404 then