# HG changeset patch # User Kim Alvefur # Date 1552305651 -3600 # Node ID 9aea8dbb105dc8357e6a9b6fa223d213dfe4b79f # Parent 6ea3cafb6ac3c18f5673eca1d825cc37eefd1f5c net.server: Only add alternate SNI contexts if at least one is provided Fixes use of when a client sends SNI, which would send no certificate otherwise. diff -r 6ea3cafb6ac3 -r 9aea8dbb105d net/server_epoll.lua --- a/net/server_epoll.lua Sun Mar 10 19:58:28 2019 +0100 +++ b/net/server_epoll.lua Mon Mar 11 13:00:51 2019 +0100 @@ -512,7 +512,7 @@ if conn.sni then if self.servername then conn:sni(self.servername); - elseif self._server and self._server.hosts then + elseif self._server and type(self._server.hosts) == "table" and next(self._server.hosts) ~= nil then conn:sni(self._server.hosts, true); end end diff -r 6ea3cafb6ac3 -r 9aea8dbb105d net/server_event.lua --- a/net/server_event.lua Sun Mar 10 19:58:28 2019 +0100 +++ b/net/server_event.lua Mon Mar 11 13:00:51 2019 +0100 @@ -168,7 +168,7 @@ if self.conn.sni then if self.servername then self.conn:sni(self.servername); - elseif self._server and self._server.hosts then + elseif self._server and type(self._server.hosts) == "table" and next(self._server.hosts) ~= nil then self.conn:sni(self._server.hosts, true); end end diff -r 6ea3cafb6ac3 -r 9aea8dbb105d net/server_select.lua --- a/net/server_select.lua Sun Mar 10 19:58:28 2019 +0100 +++ b/net/server_select.lua Mon Mar 11 13:00:51 2019 +0100 @@ -637,7 +637,7 @@ if socket.sni then if self.servername then socket:sni(self.servername); - elseif self.server() and self.server().hosts then + elseif self._server and type(self._server.hosts) == "table" and next(self._server.hosts) ~= nil then socket:sni(self.server().hosts, true); end end