Changeset

9847:adc0672b700e

net.server_epoll: Add support for SNI (#409)
author Kim Alvefur <zash@zash.se>
date Sun, 10 Mar 2019 19:35:34 +0100
parents 9846:9a0da809ed4a
children 9848:b923053e69ba
files net/server_epoll.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Sun Mar 10 18:05:08 2019 +0100
+++ b/net/server_epoll.lua	Sun Mar 10 19:35:34 2019 +0100
@@ -509,6 +509,13 @@
 		end
 		conn:settimeout(0);
 		self.conn = conn;
+		if conn.sni then
+			if self.servername then
+				conn:sni(self.servername);
+			elseif self._server and self._server.hosts then
+				conn:sni(self._server.hosts, true);
+			end
+		end
 		self:on("starttls");
 		self.ondrain = nil;
 		self.onwritable = interface.tlshandskake;
@@ -649,6 +656,7 @@
 		onreadable = interface.onacceptable;
 		tls_ctx = config and config.tls_ctx;
 		tls_direct = config and config.tls_direct;
+		hosts = config and config.sni_hosts;
 		sockname = addr;
 		sockport = port;
 	}, interface_mt);