Software /
code /
prosody
Diff
plugins/mod_http.lua @ 12924:ae0fba27fc24
Merge 0.12->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 05 Mar 2023 15:45:44 +0100 |
parent | 12923:419e55abd285 |
child | 12977:74b9e05af71e |
child | 13139:5d5869f14c4d |
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