From 5764e73a65351f9284e309fe423b3001fc4265c9 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 21 Jan 2024 22:59:50 +0100 Subject: net.server_epoll: Prevent traceback when checking TLS after connection gone Unclear why this would be done, but an error is not great. --- net/server_epoll.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/server_epoll.lua b/net/server_epoll.lua index fe60dc78..18c18823 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -630,30 +630,35 @@ end function interface:ssl_info() local sock = self.conn; + if not sock then return nil, "not-connected" end if not sock.info then return nil, "not-implemented"; end return sock:info(); end function interface:ssl_peercertificate() local sock = self.conn; + if not sock then return nil, "not-connected" end if not sock.getpeercertificate then return nil, "not-implemented"; end return sock:getpeercertificate(); end function interface:ssl_peerverification() local sock = self.conn; + if not sock then return nil, "not-connected" end if not sock.getpeerverification then return nil, { { "Chain verification not supported" } }; end return sock:getpeerverification(); end function interface:ssl_peerfinished() local sock = self.conn; + if not sock then return nil, "not-connected" end if not sock.getpeerfinished then return nil, "not-implemented"; end return sock:getpeerfinished(); end function interface:ssl_exportkeyingmaterial(label, len, context) local sock = self.conn; + if not sock then return nil, "not-connected" end if sock.exportkeyingmaterial then return sock:exportkeyingmaterial(label, len, context); end -- cgit v1.2.3