aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-05-18 21:43:24 +0200
committerKim Alvefur <zash@zash.se>2015-05-18 21:43:24 +0200
commit3f9b6834573752a09e06196792bcce7774fd6f1e (patch)
tree2616ea115f5282cf899e06a176cfc84de6fd7239
parentbac4a10b348e1420fecaff6481ab585838cf306f (diff)
downloadprosody-3f9b6834573752a09e06196792bcce7774fd6f1e.tar.gz
prosody-3f9b6834573752a09e06196792bcce7774fd6f1e.zip
mod_tls: Build <starttls/> as a stanza instead of with string concatenation
-rw-r--r--plugins/mod_tls.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua
index f9d2cee9..85fa172a 100644
--- a/plugins/mod_tls.lua
+++ b/plugins/mod_tls.lua
@@ -21,6 +21,7 @@ end
local xmlns_starttls = 'urn:ietf:params:xml:ns:xmpp-tls';
local starttls_attr = { xmlns = xmlns_starttls };
+local starttls_initiate= st.stanza("starttls", starttls_attr);
local starttls_proceed = st.stanza("proceed", starttls_attr);
local starttls_failure = st.stanza("failure", starttls_attr);
local c2s_feature = st.stanza("starttls", starttls_attr);
@@ -116,7 +117,7 @@ module:hook_stanza("http://etherx.jabber.org/streams", "features", function (ses
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);
- session.sends2s("<starttls xmlns='"..xmlns_starttls.."'/>");
+ session.sends2s(starttls_initiate);
return true;
end
end, 500);