Changeset

2751:1d7746c3a8c6

sessionmanager: Return stream error when incoming stream header is missing 'to' attribute
author Matthew Wild <mwild1@gmail.com>
date Sun, 14 Mar 2010 02:59:16 +0000
parents 2750:4a6f32e6a8e5
children 2752:18d8009f06cb
files core/sessionmanager.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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();