plugins/mod_bosh.lua
branch0.11
changeset 11128 1aea75b63d0a
parent 11127 0f4260f99ea2
child 11129 5bcddab1659b
child 11544 1937b3c3efb5
equal deleted inserted replaced
11127:0f4260f99ea2 11128: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