Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
9849:70e56f126177 | 9850:9a905888b96c |
---|---|
162 end | 162 end |
163 self:_close() | 163 self:_close() |
164 debug( "fatal error while ssl wrapping:", err ) | 164 debug( "fatal error while ssl wrapping:", err ) |
165 return false | 165 return false |
166 end | 166 end |
167 | |
168 if self.conn.sni then | |
169 if self.servername then | |
170 self.conn:sni(self.servername); | |
171 elseif self._server and self._server.hosts then | |
172 self.conn:sni(self._server.hosts, true); | |
173 end | |
174 end | |
175 | |
167 self.conn:settimeout( 0 ) -- set non blocking | 176 self.conn:settimeout( 0 ) -- set non blocking |
168 local handshakecallback = coroutine_wrap(function( event ) | 177 local handshakecallback = coroutine_wrap(function( event ) |
169 local _, err | 178 local _, err |
170 local attempt = 0 | 179 local attempt = 0 |
171 local maxattempt = cfg.MAX_HANDSHAKE_ATTEMPTS | 180 local maxattempt = cfg.MAX_HANDSHAKE_ATTEMPTS |
663 fatalerror = false; -- error message | 672 fatalerror = false; -- error message |
664 nointerface = true; -- lock/unlock parameter | 673 nointerface = true; -- lock/unlock parameter |
665 | 674 |
666 _ip = addr, _port = port, _pattern = pattern, | 675 _ip = addr, _port = port, _pattern = pattern, |
667 _sslctx = sslctx; | 676 _sslctx = sslctx; |
677 hosts = {}; | |
668 } | 678 } |
669 interface.id = tostring(interface):match("%x+$"); | 679 interface.id = tostring(interface):match("%x+$"); |
670 interface.readcallback = function( event ) -- server handler, called on incoming connections | 680 interface.readcallback = function( event ) -- server handler, called on incoming connections |
671 --vdebug( "server can accept, id/addr/port:", interface, addr, port ) | 681 --vdebug( "server can accept, id/addr/port:", interface, addr, port ) |
672 if interface.fatalerror then | 682 if interface.fatalerror then |