diff options
author | Kim Alvefur <zash@zash.se> | 2021-12-22 19:27:03 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-12-22 19:27:03 +0100 |
commit | 6d8f1d56ed776eb03374a66410703c7d24be07a3 (patch) | |
tree | 2e22a64fe024f867e01fdf8ce457bb30473e0378 | |
parent | 2f3b28380a3c68e48bd0e1a159f6bcdee7cad19f (diff) | |
download | prosody-6d8f1d56ed776eb03374a66410703c7d24be07a3.tar.gz prosody-6d8f1d56ed776eb03374a66410703c7d24be07a3.zip |
mod_http: Clean up redirects handlers for wildcard on http module unload
These would previously be left behind. Probably mostly harmless except
for clogging up the `debug:events()` listing in the console.
-rw-r--r-- | plugins/mod_http.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index de34cd5f..100581b5 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -227,6 +227,13 @@ function module.add_host(module) for event_name, handlers in pairs(app_handlers) do module:unhook_object_event(server, event_name, handlers.main); module:unhook_object_event(server, event_name, handlers.cors); + + if event_name:sub(-2, -1) == "/*" then + module:unhook_object_event(server, event_name:sub(1, -3), redir_handler, -1); + elseif event_name:sub(-1, -1) == "/" then + module:unhook_object_event(server, event_name:sub(1, -2), redir_handler, -1); + end + local options_event_name = event_name:gsub("^%S+", "OPTIONS"); module:unhook_object_event(server, options_event_name, handlers.options); end |