# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1268535556 0
# Node ID 1d7746c3a8c6f33a13c5b2314c00d6cdcdd4eb2e
# Parent  4a6f32e6a8e558906b8adb4ea56b0407347951c9
sessionmanager: Return stream error when incoming stream header is missing 'to' attribute

diff -r 4a6f32e6a8e5 -r 1d7746c3a8c6 core/sessionmanager.lua
--- a/core/sessionmanager.lua	Sun Mar 14 02:58:11 2010 +0000
+++ b/core/sessionmanager.lua	Sun Mar 14 02:59:16 2010 +0000
@@ -181,7 +181,12 @@
 
 function streamopened(session, attr)
 	local send = session.send;
-	session.host = attr.to or error("Client failed to specify destination hostname");
+	session.host = attr.to;
+	if not session.host then
+		session:close{ condition = "improper-addressing",
+			text = "A 'to' attribute is required on stream headers" };
+		return;
+	end
 	session.host = nameprep(session.host);
 	session.version = tonumber(attr.version) or 0;
 	session.streamid = uuid_generate();