Changeset

10234:d4390c427a66

net.server: Handle server name (SNI) as extra argument Code added in 75d2874502c3, 9a905888b96c and adc0672b700e uses this field. See #409 and #1408
author Kim Alvefur <zash@zash.se>
date Sun, 01 Sep 2019 01:58:38 +0200
parents 10233:600eee3c4752
children 10235:6c804b6b2ca2
files net/server_epoll.lua net/server_event.lua net/server_select.lua
diffstat 3 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Sun Sep 01 01:55:55 2019 +0200
+++ b/net/server_epoll.lua	Sun Sep 01 01:58:38 2019 +0200
@@ -575,6 +575,12 @@
 		extra = extra;
 	}, interface_mt);
 
+	if extra then
+		if extra.servername then
+			conn.servername = extra.servername;
+		end
+	end
+
 	conn:updatenames();
 	return conn;
 end
--- a/net/server_event.lua	Sun Sep 01 01:55:55 2019 +0200
+++ b/net/server_event.lua	Sun Sep 01 01:58:38 2019 +0200
@@ -516,6 +516,7 @@
 		_sslctx = sslctx; -- parameters
 		_usingssl = false;  -- client is using ssl;
 		extra = extra;
+		servername = extra and extra.servername;
 	}
 	if not has_luasec then interface.starttls = false; end
 	interface.id = tostring(interface):match("%x+$");
--- a/net/server_select.lua	Sun Sep 01 01:55:55 2019 +0200
+++ b/net/server_select.lua	Sun Sep 01 01:58:38 2019 +0200
@@ -317,6 +317,9 @@
 	local handler = bufferqueue -- saves a table ^_^
 
 	handler.extra = extra
+	if extra then
+		handler.servername = extra.servername
+	end
 
 	handler.dispatch = function( )
 		return dispatch