Comparison

plugins/mod_websocket.lua @ 9805:7bfc4269dc36 0.11

mod_websocket: Log an error if cross_domain_websocket = true is set in a VirtualHost section
author Kim Alvefur <zash@zash.se>
date Tue, 22 Jan 2019 10:41:00 +0100
parent 9800:5c5117d41133
child 9806:b72d2f4153f7
child 10092:4b3c129e96f2
comparison
equal deleted inserted replaced
9800:5c5117d41133 9805:7bfc4269dc36
336 local url_components = url.parse(ws_url); 336 local url_components = url.parse(ws_url);
337 -- The 'Origin' consists of the base URL without path 337 -- The 'Origin' consists of the base URL without path
338 url_components.path = nil; 338 url_components.path = nil;
339 local this_origin = url.build(url_components); 339 local this_origin = url.build(url_components);
340 local local_cross_domain = module:get_option_set("cross_domain_websocket", { this_origin }); 340 local local_cross_domain = module:get_option_set("cross_domain_websocket", { this_origin });
341 if local_cross_domain:contains(true) then
342 module:log("error", "cross_domain_websocket = true only works in the global section");
343 return;
344 end
345
341 -- Don't add / remove something added by another host 346 -- Don't add / remove something added by another host
342 -- This might be weird with random load order 347 -- This might be weird with random load order
343 local_cross_domain:exclude(cross_domain); 348 local_cross_domain:exclude(cross_domain);
344 cross_domain:include(local_cross_domain); 349 cross_domain:include(local_cross_domain);
345 module:log("debug", "cross_domain = %s", tostring(cross_domain)); 350 module:log("debug", "cross_domain = %s", tostring(cross_domain));