# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1284137784 -3600
# Node ID 6d782b1fcc8ac63b5cb68bab298324c52de13924
# Parent  e8c06d20a18b20b6f60e9a924cf8f2e40b56729f
mod_bosh: Fix traceback when initiating a BOSH session to an unknown host

diff -r e8c06d20a18b -r 6d782b1fcc8a plugins/mod_bosh.lua
--- a/plugins/mod_bosh.lua	Thu Sep 09 20:10:28 2010 +0100
+++ b/plugins/mod_bosh.lua	Fri Sep 10 17:56:24 2010 +0100
@@ -218,9 +218,9 @@
 		if not hosts[attr.to] then
 			-- Unknown host
 			log("debug", "BOSH client tried to connect to unknown host: %s", tostring(attr.to));
-			session_close_reply.body.attr.condition = "host-unknown";
-			request:send(session_close_reply);
-			request.notopen = nil
+			local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
+				["xmlns:streams"] = xmlns_streams, condition = "host-unknown" });
+			request:send(tostring(close_reply));
 			return;
 		end