Software /
code /
prosody
Changeset
9853:9aea8dbb105d
net.server: Only add alternate SNI contexts if at least one is provided
Fixes use of <starttls/> when a client sends SNI, which would send no certificate otherwise.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 11 Mar 2019 13:00:51 +0100 |
parents | 9852:6ea3cafb6ac3 |
children | 9854:115b5e32d960 |
files | net/server_epoll.lua net/server_event.lua net/server_select.lua |
diffstat | 3 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- 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