Software /
code /
prosody
Diff
net/server_event.lua @ 9850:9a905888b96c
net.server_event: Add SNI support (#409)
Snippet adapted from server_epoll
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 10 Mar 2019 19:32:54 +0100 |
parent | 9835:20bf5b47c1fb |
child | 9853:9aea8dbb105d |
line wrap: on
line diff
--- a/net/server_event.lua Fri Sep 14 01:30:56 2018 +0200 +++ b/net/server_event.lua Sun Mar 10 19:32:54 2019 +0100 @@ -164,6 +164,15 @@ 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 @@ _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