Changeset

12924:ae0fba27fc24

Merge 0.12->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 05 Mar 2023 15:45:44 +0100
parents 12922:aaf055d6fe7a (current diff) 12923:419e55abd285 (diff)
children 12925:6cb339423928
files
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_http.lua	Sun Mar 05 14:08:26 2023 +0100
+++ b/plugins/mod_http.lua	Sun Mar 05 15:45:44 2023 +0100
@@ -261,7 +261,9 @@
 		apps[event.item.name] = nil;
 		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 handlers.cors then
+				module:unhook_object_event(server, event_name, handlers.cors);
+			end
 
 			if event_name:sub(-2, -1) == "/*" then
 				module:unhook_object_event(server, event_name:sub(1, -3), redir_handler, -1);
@@ -269,8 +271,10 @@
 				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);
+			if handlers.options then
+				local options_event_name = event_name:gsub("^%S+", "OPTIONS");
+				module:unhook_object_event(server, options_event_name, handlers.options);
+			end
 		end
 	end