Software /
code /
prosody
Comparison
plugins/mod_tls.lua @ 1943:3d4c703d9333
mod_tls: Don't try to start TLS if we can't actually do it (thanks Florob)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 09 Oct 2009 17:48:45 +0100 |
parent | 1938:82342e7f1b84 |
child | 1981:ffbc57a4dea8 |
comparison
equal
deleted
inserted
replaced
1942:f74c267f7e1b | 1943:3d4c703d9333 |
---|---|
71 | 71 |
72 -- For s2sout connections, start TLS if we can | 72 -- For s2sout connections, start TLS if we can |
73 module:hook_stanza(xmlns_stream, "features", | 73 module:hook_stanza(xmlns_stream, "features", |
74 function (session, stanza) | 74 function (session, stanza) |
75 module:log("debug", "Received features element"); | 75 module:log("debug", "Received features element"); |
76 if stanza:child_with_ns(xmlns_starttls) then | 76 if session.conn.starttls and stanza:child_with_ns(xmlns_starttls) then |
77 module:log("%s is offering TLS, taking up the offer...", session.to_host); | 77 module:log("%s is offering TLS, taking up the offer...", session.to_host); |
78 session.sends2s("<starttls xmlns='"..xmlns_starttls.."'/>"); | 78 session.sends2s("<starttls xmlns='"..xmlns_starttls.."'/>"); |
79 return true; | 79 return true; |
80 end | 80 end |
81 end, 500); | 81 end, 500); |