Comparison

plugins/mod_bosh.lua @ 11124:1aea75b63d0a 0.11

mod_bosh: Ensure that stream is directed to a VirtualHost (fixes #425)
author Kim Alvefur <zash@zash.se>
date Sat, 03 Oct 2020 15:03:09 +0200
parent 11123:0f4260f99ea2
child 11125:5bcddab1659b
child 11540:1937b3c3efb5
comparison
equal deleted inserted replaced
11123:0f4260f99ea2 11124:1aea75b63d0a
269 context.notopen = nil; -- Signals that we accept this opening tag 269 context.notopen = nil; -- Signals that we accept this opening tag
270 270
271 local to_host = nameprep(attr.to); 271 local to_host = nameprep(attr.to);
272 if not to_host then 272 if not to_host then
273 log("debug", "BOSH client tried to connect to invalid host: %s", tostring(attr.to)); 273 log("debug", "BOSH client tried to connect to invalid host: %s", tostring(attr.to));
274 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
275 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" });
276 response:send(tostring(close_reply));
277 return;
278 end
279
280 if not prosody.hosts[to_host] then
281 log("debug", "BOSH client tried to connect to non-existant host: %s", attr.to);
282 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
283 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" });
284 response:send(tostring(close_reply));
285 return;
286 end
287
288 if prosody.hosts[to_host].type ~= "local" then
289 log("debug", "BOSH client tried to connect to %s host: %s", prosody.hosts[to_host].type, attr.to);
274 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", 290 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
275 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); 291 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" });
276 response:send(tostring(close_reply)); 292 response:send(tostring(close_reply));
277 return; 293 return;
278 end 294 end