-function starttls_handler(session, stanza)
- if session.conn.starttls then
- (session.sends2s or session.send)(st.stanza("proceed", { xmlns = xmlns_starttls }));
- session:reset_stream();
- local host = session.to_host or session.host;
- local ssl_ctx = host and hosts[host].ssl_ctx_in or global_ssl_ctx;
- session.conn:starttls(ssl_ctx);
- session.log("info", "TLS negotiation started for %s...", session.type);
- session.secure = false;
- else
- -- FIXME: What reply?
- session.log("warn", "Attempt to start TLS, but TLS is not available on this %s connection", session.type);
- end
-end
-