88 |
88 |
89 module:hook_stanza(xmlns_starttls, "proceed", |
89 module:hook_stanza(xmlns_starttls, "proceed", |
90 function (session, stanza) |
90 function (session, stanza) |
91 module:log("debug", "Proceeding with TLS on s2sout..."); |
91 module:log("debug", "Proceeding with TLS on s2sout..."); |
92 local format, to_host, from_host = string.format, session.to_host, session.from_host; |
92 local format, to_host, from_host = string.format, session.to_host, session.from_host; |
|
93 local ssl_ctx = session.from_host and hosts[session.from_host].ssl_ctx or global_ssl_ctx; |
|
94 session.conn.set_sslctx(ssl_ctx); |
93 session:reset_stream(); |
95 session:reset_stream(); |
94 session.conn.starttls(true); |
96 session.conn.starttls(true); |
95 session.secure = false; |
97 session.secure = false; |
96 return true; |
98 return true; |
97 end); |
99 end); |