Changeset

4551:8f25f3b1c62f

mod_c2s: Code reduction
author Matthew Wild <mwild1@gmail.com>
date Mon, 23 Jan 2012 02:15:28 +0000
parents 4550:1c41e4a846a2
children 4552:414d857ee125
files plugins/mod_c2s.lua
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Mon Jan 23 01:05:32 2012 +0000
+++ b/plugins/mod_c2s.lua	Mon Jan 23 02:15:28 2012 +0000
@@ -39,13 +39,12 @@
 
 function stream_callbacks.streamopened(session, attr)
 	local send = session.send;
-	session.host = attr.to;
+	session.host = nameprep(attr.to);
 	if not session.host then
 		session:close{ condition = "improper-addressing",
-			text = "A 'to' attribute is required on stream headers" };
+			text = "A valid '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();
 	(session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host);