# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1611958628 -3600
# Node ID a7109eb45e3016d66531ea0681f749c3a08a2c25
# Parent  25260c20c5a4c1dbd3df32d033efb92b2e450ef5
mod_tls: Attempt STARTTLS even if not advertised as per RFC 7590

diff -r 25260c20c5a4 -r a7109eb45e30 doc/doap.xml
--- a/doc/doap.xml	Fri Jan 29 23:14:48 2021 +0100
+++ b/doc/doap.xml	Fri Jan 29 23:17:08 2021 +0100
@@ -54,6 +54,7 @@
     <implements rdf:resource="https://www.rfc-editor.org/info/rfc6455"/>
     <implements rdf:resource="https://www.rfc-editor.org/info/rfc7301"/>
     <implements rdf:resource="https://www.rfc-editor.org/info/rfc7395"/>
+    <implements rdf:resource="https://www.rfc-editor.org/info/rfc7390"/>
     <implements rdf:resource="https://datatracker.ietf.org/doc/draft-cridland-xmpp-session/">
       <!-- since=0.6.0 note=Added in hg:0bbbc9042361 -->
     </implements>
diff -r 25260c20c5a4 -r a7109eb45e30 plugins/mod_tls.lua
--- a/plugins/mod_tls.lua	Fri Jan 29 23:14:48 2021 +0100
+++ b/plugins/mod_tls.lua	Fri Jan 29 23:17:08 2021 +0100
@@ -150,8 +150,12 @@
 -- For s2sout connections, start TLS if we can
 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza)
 	module:log("debug", "Received features element");
-	if can_do_tls(session) and stanza:get_child("starttls", xmlns_starttls) then
-		module:log("debug", "%s is offering TLS, taking up the offer...", session.to_host);
+	if can_do_tls(session) then
+		if stanza:get_child("starttls", xmlns_starttls) then
+			module:log("debug", "%s is offering TLS, taking up the offer...", session.to_host);
+		else
+			module:log("debug", "%s is *not* offering TLS, trying anyways!", session.to_host);
+		end
 		session.sends2s(starttls_initiate);
 		return true;
 	end