diff options
author | Kim Alvefur <zash@zash.se> | 2019-03-10 19:32:54 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-03-10 19:32:54 +0100 |
commit | af5e6fcb649c43591524e5f00bf178428718123a (patch) | |
tree | d423abb149c9568e0a314e814efac91e75e437a3 | |
parent | 2878ed99a5780d3de6714f1f8141fa6f1661f2cb (diff) | |
download | prosody-af5e6fcb649c43591524e5f00bf178428718123a.tar.gz prosody-af5e6fcb649c43591524e5f00bf178428718123a.zip |
net.server_event: Add SNI support (#409)
Snippet adapted from server_epoll
-rw-r--r-- | net/server_event.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/server_event.lua b/net/server_event.lua index b78bf412..6c9b941d 100644 --- a/net/server_event.lua +++ b/net/server_event.lua @@ -164,6 +164,15 @@ function interface_mt:_start_ssl(call_onconnect) -- old socket will be destroyed debug( "fatal error while ssl wrapping:", err ) return false end + + if self.conn.sni then + if self.servername then + self.conn:sni(self.servername); + elseif self._server and self._server.hosts then + self.conn:sni(self._server.hosts, true); + end + end + self.conn:settimeout( 0 ) -- set non blocking local handshakecallback = coroutine_wrap(function( event ) local _, err @@ -665,6 +674,7 @@ local function handleserver( server, addr, port, pattern, listener, sslctx, star _ip = addr, _port = port, _pattern = pattern, _sslctx = sslctx; + hosts = {}; } interface.id = tostring(interface):match("%x+$"); interface.readcallback = function( event ) -- server handler, called on incoming connections |