Software /
code /
prosody
Changeset
9851:75d2874502c3
net.server_select: SNI support (#409)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 10 Mar 2019 19:32:33 +0100 |
parents | 9850:9a905888b96c |
children | 9852:6ea3cafb6ac3 |
files | net/server_select.lua |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server_select.lua Sun Mar 10 19:32:54 2019 +0100 +++ b/net/server_select.lua Sun Mar 10 19:32:33 2019 +0100 @@ -184,6 +184,7 @@ handler.sslctx = function( ) return sslctx end + handler.hosts = {} -- sni handler.remove = function( ) connections = connections - 1 if handler then @@ -627,11 +628,20 @@ 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