plugins/mod_admin_telnet.lua
branch0.11
changeset 10703 fd77b6cec38d
parent 10622 232841373711
child 10705 929c95e518f0
--- a/plugins/mod_admin_telnet.lua	Thu Mar 12 20:32:07 2020 +0000
+++ b/plugins/mod_admin_telnet.lua	Sun Mar 22 17:35:26 2020 +0100
@@ -528,11 +528,14 @@
 	common_info(session, line);
 	if session.secure then
 		local sock = session.conn and session.conn.socket and session.conn:socket();
-		if sock and sock.info then
-			local info = sock:info();
-			line[#line+1] = ("(%s with %s)"):format(info.protocol, info.cipher);
-		else
-			line[#line+1] = "(cipher info unavailable)";
+		if sock then
+			local info = sock.info and sock:info();
+			if info then
+				line[#line+1] = ("(%s with %s)"):format(info.protocol, info.cipher);
+			else
+				-- TLS session might not be ready yet
+				line[#line+1] = "(cipher info unavailable)";
+			end
 		end
 	else
 		line[#line+1] = "(insecure)";