diff options
author | Kim Alvefur <zash@zash.se> | 2019-03-10 19:32:33 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-03-10 19:32:33 +0100 |
commit | b47d67c80fe77a3414c8f0ef1fa92cec96696e54 (patch) | |
tree | 92b117695ca95a40201e0a219d20c9792861c642 /net | |
parent | 700f9dceb670bb7dacddbbb5800e6ba12927b409 (diff) | |
download | prosody-b47d67c80fe77a3414c8f0ef1fa92cec96696e54.tar.gz prosody-b47d67c80fe77a3414c8f0ef1fa92cec96696e54.zip |
net.server_select: SNI support (#409)
Diffstat (limited to 'net')
-rw-r--r-- | net/server_select.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/server_select.lua b/net/server_select.lua index d82936e6..b52cc6d7 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -184,6 +184,7 @@ wrapserver = function( listeners, socket, ip, serverport, pattern, sslctx, ssldi handler.sslctx = function( ) return sslctx end + handler.hosts = {} -- sni handler.remove = function( ) connections = connections - 1 if handler then @@ -627,11 +628,20 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport out_put( "server.lua: attempting to start tls on " .. tostring( socket ) ) local oldsocket, err = socket socket, err = ssl_wrap( socket, sslctx ) -- wrap socket + if not socket then out_put( "server.lua: error while starting tls on client: ", tostring(err or "unknown error") ) return nil, err -- fatal error end + if socket.sni then + if self.servername then + socket:sni(self.servername); + elseif self.server() and self.server().hosts then + socket:sni(self.server().hosts, true); + end + end + socket:settimeout( 0 ) -- add the new socket to our system |