aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-09-01 01:58:38 +0200
committerKim Alvefur <zash@zash.se>2019-09-01 01:58:38 +0200
commitfb692a2cedc46229966f4a84585f292abe850ba4 (patch)
tree3a720d3bef1fa783f79dc4fa935a2b7b399da489
parent9afa1ac496bac9d9eaaf687edbdde3f0c7fb66e1 (diff)
downloadprosody-fb692a2cedc46229966f4a84585f292abe850ba4.tar.gz
prosody-fb692a2cedc46229966f4a84585f292abe850ba4.zip
net.server: Handle server name (SNI) as extra argument
Code added in 75d2874502c3, 9a905888b96c and adc0672b700e uses this field. See #409 and #1408
-rw-r--r--net/server_epoll.lua6
-rw-r--r--net/server_event.lua1
-rw-r--r--net/server_select.lua3
3 files changed, 10 insertions, 0 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 96e7b201..f48086e3 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -575,6 +575,12 @@ local function wrapsocket(client, server, read_size, listeners, tls_ctx, extra)
extra = extra;
}, interface_mt);
+ if extra then
+ if extra.servername then
+ conn.servername = extra.servername;
+ end
+ end
+
conn:updatenames();
return conn;
end
diff --git a/net/server_event.lua b/net/server_event.lua
index 950a7a5c..2b791291 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -516,6 +516,7 @@ local function handleclient( client, ip, port, server, pattern, listener, sslctx
_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+$");
diff --git a/net/server_select.lua b/net/server_select.lua
index de183331..e15f5298 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -317,6 +317,9 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
local handler = bufferqueue -- saves a table ^_^
handler.extra = extra
+ if extra then
+ handler.servername = extra.servername
+ end
handler.dispatch = function( )
return dispatch