plugins/mod_bosh.lua
changeset 10381 4c36bc28b99e
parent 10115 0f335815244f
child 10732 2764beb552cd
--- a/plugins/mod_bosh.lua	Sat Nov 02 15:27:53 2019 +0100
+++ b/plugins/mod_bosh.lua	Sat Nov 02 15:29:13 2019 +0100
@@ -272,6 +272,15 @@
 		-- New session request
 		context.notopen = nil; -- Signals that we accept this opening tag
 
+		if not attr.to then
+			log("debug", "BOSH client tried to connect without specifying a host");
+			report_bad_host();
+			local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
+				["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" });
+			response:send(tostring(close_reply));
+			return;
+		end
+
 		local to_host = nameprep(attr.to);
 		local wait = tonumber(attr.wait);
 		if not to_host then