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.
This commit is contained in:
Kim Alvefur 2021-12-22 19:27:03 +01:00
parent 2f3b28380a
commit 6d8f1d56ed

View file

@ -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