net.server_epoll: Fix to get remote IP on direct TLS connections
authorKim Alvefur <zash@zash.se>
Sat, 12 Oct 2019 20:07:50 +0200
changeset 10333 c0a72c97e6cf
parent 10332 5c2b31c823b9
child 10334 d86b1304451a
net.server_epoll: Fix to get remote IP on direct TLS connections A Direct TLS connection (eg HTTPS) gets turned into a LuaSec handle before the :updatenames call done in the :connect method. LuaSec does not expose the :getpeername and :getsockname methods, so the addresses remain obscured, making debugging trickier since the actual IP addrerss connected to does not show up.
net/server_epoll.lua
--- a/net/server_epoll.lua	Sat Oct 12 19:51:29 2019 +0200
+++ b/net/server_epoll.lua	Sat Oct 12 20:07:50 2019 +0200
@@ -521,6 +521,7 @@
 		self._tls = true;
 		self:debug("Starting TLS now");
 		self:del();
+		self:updatenames(); -- Can't getpeer/sockname after wrap()
 		local ok, conn, err = pcall(luasec.wrap, self.conn, self.tls_ctx);
 		if not ok then
 			conn, err = ok, conn;