aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-03-05 15:45:44 +0100
committerKim Alvefur <zash@zash.se>2023-03-05 15:45:44 +0100
commit11a3373e890b71e937fbfd3283a427f7b782d484 (patch)
tree4fec3432e73fa3929367bb298557b8a6f4004cc5
parent283322543ed407640c9ac806120040a057f0b6dd (diff)
parent0890b20fbff4bff4c557d79ec53f36016085da82 (diff)
downloadprosody-11a3373e890b71e937fbfd3283a427f7b782d484.tar.gz
prosody-11a3373e890b71e937fbfd3283a427f7b782d484.zip
Merge 0.12->trunk
-rw-r--r--plugins/mod_http.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index 66012239..01bb1f6f 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -261,7 +261,9 @@ function module.add_host(module)
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 @@ function module.add_host(module)
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