sessionmanager: Return stream error when incoming stream header is missing 'to' attribute

Sun, 14 Mar 2010 02:59:16 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 14 Mar 2010 02:59:16 +0000
changeset 2751
1d7746c3a8c6
parent 2750
4a6f32e6a8e5
child 2752
18d8009f06cb

sessionmanager: Return stream error when incoming stream header is missing 'to' attribute

core/sessionmanager.lua file | annotate | diff | comparison | revisions
--- 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();

mercurial