Comparison

plugins/mod_http.lua @ 12113:86e6f0810956

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.
author Kim Alvefur <zash@zash.se>
date Wed, 22 Dec 2021 19:27:03 +0100
parent 11727:f3aee8a825cc
child 12187:94253e02d47d
comparison
equal deleted inserted replaced
12112:08a949e63541 12113:86e6f0810956
225 local app_handlers = apps[event.item.name]; 225 local app_handlers = apps[event.item.name];
226 apps[event.item.name] = nil; 226 apps[event.item.name] = nil;
227 for event_name, handlers in pairs(app_handlers) do 227 for event_name, handlers in pairs(app_handlers) do
228 module:unhook_object_event(server, event_name, handlers.main); 228 module:unhook_object_event(server, event_name, handlers.main);
229 module:unhook_object_event(server, event_name, handlers.cors); 229 module:unhook_object_event(server, event_name, handlers.cors);
230
231 if event_name:sub(-2, -1) == "/*" then
232 module:unhook_object_event(server, event_name:sub(1, -3), redir_handler, -1);
233 elseif event_name:sub(-1, -1) == "/" then
234 module:unhook_object_event(server, event_name:sub(1, -2), redir_handler, -1);
235 end
236
230 local options_event_name = event_name:gsub("^%S+", "OPTIONS"); 237 local options_event_name = event_name:gsub("^%S+", "OPTIONS");
231 module:unhook_object_event(server, options_event_name, handlers.options); 238 module:unhook_object_event(server, options_event_name, handlers.options);
232 end 239 end
233 end 240 end
234 241