Comparison

plugins/mod_bosh.lua @ 8525:7be8f649d97d

mod_bosh: Return implicit 404 instead of the proper BOSH terminate thing
author Kim Alvefur <zash@zash.se>
date Wed, 27 Dec 2017 01:00:34 +0100
parent 8524:81fff93d3bc6
child 8594:b4a0bc46c82d
comparison
equal deleted inserted replaced
8524:81fff93d3bc6 8525:7be8f649d97d
281 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", 281 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
282 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); 282 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" });
283 response:send(tostring(close_reply)); 283 response:send(tostring(close_reply));
284 return; 284 return;
285 elseif to_host ~= module.host then 285 elseif to_host ~= module.host then
286 -- Unknown host 286 -- Could be meant for a different instance of the module
287 log("debug", "BOSH client tried to connect to unknown host: %s", tostring(attr.to)); 287 -- if multiple instances are loaded with the same URL then this can happen
288 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", 288 return; --> 404
289 ["xmlns:stream"] = xmlns_streams, condition = "host-unknown" });
290 response:send(tostring(close_reply));
291 return;
292 end 289 end
293 if not rid or (not wait and attr.wait or wait < 0 or wait % 1 ~= 0) then 290 if not rid or (not wait and attr.wait or wait < 0 or wait % 1 ~= 0) then
294 log("debug", "BOSH client sent invalid rid or wait attributes: rid=%s, wait=%s", tostring(attr.rid), tostring(attr.wait)); 291 log("debug", "BOSH client sent invalid rid or wait attributes: rid=%s, wait=%s", tostring(attr.rid), tostring(attr.wait));
295 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", 292 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
296 ["xmlns:stream"] = xmlns_streams, condition = "bad-request" }); 293 ["xmlns:stream"] = xmlns_streams, condition = "bad-request" });