Software /
code /
prosody
Changeset
7764:d6b96e42e8e6
mod_websocket: Allow per-host cross_domain_websocket, defaulting to the base URL of the current host
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 05 Dec 2016 12:23:51 +0100 |
parents | 7763:c5ce14539fc4 |
children | 7765:4757c3644168 7766:5594d0caa5a8 |
files | plugins/mod_websocket.lua |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_websocket.lua Mon Dec 05 12:23:41 2016 +0100 +++ b/plugins/mod_websocket.lua Mon Dec 05 12:23:51 2016 +0100 @@ -323,9 +323,13 @@ -- 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