aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_websocket.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-12-05 12:23:51 +0100
committerKim Alvefur <zash@zash.se>2016-12-05 12:23:51 +0100
commitcc617421b1b118c4bfa7067f4ff6a3ee001143f1 (patch)
treec7f4e074f012fb2284fe8b37bfc75f1a9646ccb2 /plugins/mod_websocket.lua
parenta6443e8ff35cadd1ec395d8d464e4d7119fb1259 (diff)
downloadprosody-cc617421b1b118c4bfa7067f4ff6a3ee001143f1.tar.gz
prosody-cc617421b1b118c4bfa7067f4ff6a3ee001143f1.zip
mod_websocket: Allow per-host cross_domain_websocket, defaulting to the base URL of the current host
Diffstat (limited to 'plugins/mod_websocket.lua')
-rw-r--r--plugins/mod_websocket.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/mod_websocket.lua b/plugins/mod_websocket.lua
index f6525df5..c19ad566 100644
--- a/plugins/mod_websocket.lua
+++ b/plugins/mod_websocket.lua
@@ -323,9 +323,13 @@ function module.add_host(module)
-- The 'Origin' consists of the base URL without path
url_components.path = nil;
local this_origin = url.build(url_components);
- cross_domain:add(this_origin);
+ local local_cross_domain = module:get_option_set("cross_domain_websocket", { this_origin });
+ -- Don't add / remove something added by another host
+ -- This might be weird with random load order
+ local_cross_domain:exclude(cross_domain);
+ cross_domain:include(local_cross_domain);
function module.unload()
- cross_domain:remove(this_origin);
+ cross_domain:exclude(local_cross_domain);
end
end
end