Software /
code /
prosody
Changeset
11404:f7704f987439
mod_http_errors: Add some comments
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 25 Feb 2021 13:12:07 +0100 |
parents | 11403:747e8245f180 |
children | 11405:ce8291e89d67 |
files | plugins/mod_http_errors.lua |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_http_errors.lua Thu Feb 25 12:59:28 2021 +0100 +++ b/plugins/mod_http_errors.lua Thu Feb 25 13:12:07 2021 +0100 @@ -69,6 +69,7 @@ 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 @@ 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 @@ 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