# HG changeset patch
# User Waqas Hussain <waqas20@gmail.com>
# Date 1265924390 -18000
# Node ID e64c6a4aa50b096a936df0cfc9fbd8e8a27844d0
# Parent  1e6f3002e04f1be983e545a5170952e0d7f178f9
mod_tls: Respond with proper error when TLS cannot be negotiated.

diff -r 1e6f3002e04f -r e64c6a4aa50b plugins/mod_tls.lua
--- a/plugins/mod_tls.lua	Fri Feb 12 02:32:27 2010 +0500
+++ b/plugins/mod_tls.lua	Fri Feb 12 02:39:50 2010 +0500
@@ -27,8 +27,9 @@
 		origin.log("info", "TLS negotiation started for %s...", origin.type);
 		origin.secure = false;
 	else
-		-- FIXME: What reply?
 		origin.log("warn", "Attempt to start TLS, but TLS is not available on this %s connection", origin.type);
+		(origin.sends2s or origin.send)(st.stanza("failure", { xmlns = xmlns_starttls }));
+		origin:close();
 	end
 	return true;
 end);