mod_tls: Catch s2s-stream-features and add starttls feature if possible

Thu, 08 Oct 2009 23:41:59 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 08 Oct 2009 23:41:59 +0100
changeset 1938
82342e7f1b84
parent 1937
9c700500f408
child 1939
2c295826a96d

mod_tls: Catch s2s-stream-features and add starttls feature if possible

plugins/mod_tls.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_tls.lua	Thu Oct 08 23:41:29 2009 +0100
+++ b/plugins/mod_tls.lua	Thu Oct 08 23:41:59 2009 +0100
@@ -56,11 +56,10 @@
 			end
 		end);
 
-module:add_event_hook("s2s-stream-features", 
-		function (session, features)
-			-- This hook is possibly called once per host (at least if the
-			-- remote server does not specify a to/from.
-			if session.to_host and session.conn.starttls and not features:child_with_ns(xmlns_starttls) then
+module:hook("s2s-stream-features", 
+		function (data)
+			local session, features = data.session, data.features;
+			if session.to_host and session.conn.starttls then
 				features:tag("starttls", starttls_attr):up();
 				if secure_s2s_only then
 					features:tag("required"):up():up();

mercurial