Diff

net/server_event.lua @ 12542:5ec9d6913162

net.server: Fix multiple return values return foo and foo() crops multiple return values to a single one, so any second return values etc were last, mostly error details. Introduced in 7e9ebdc75ce4
author Kim Alvefur <zash@zash.se>
date Fri, 03 Jun 2022 17:51:42 +0200
parent 12481:2ee27587fec7
child 12974:ba409c67353b
line wrap: on
line diff
--- a/net/server_event.lua	Sun Dec 06 22:04:43 2020 +0100
+++ b/net/server_event.lua	Fri Jun 03 17:51:42 2022 +0200
@@ -281,19 +281,27 @@
 end
 
 function interface_mt:ssl_info()
-	return self.conn.info and self.conn:info()
+	local sock = self.conn;
+	if not sock.info then return nil, "not-implemented"; end
+	return sock:info();
 end
 
 function interface_mt:ssl_peercertificate()
-	return self.conn.getpeercertificate and self.conn:getpeercertificate()
+	local sock = self.conn;
+	if not sock.getpeercertificate then return nil, "not-implemented"; end
+	return sock:getpeercertificate();
 end
 
 function interface_mt:ssl_peerverification()
-	return self.conn.getpeerverification and self.conn:getpeerverification()
+	local sock = self.conn;
+	if not sock.getpeerverification then return nil, { { "Chain verification not supported" } }; end
+	return sock:getpeerverification();
 end
 
 function interface_mt:ssl_peerfinished()
-	return self.conn.getpeerfinished and self.conn:getpeerfinished()
+	local sock = self.conn;
+	if not sock.getpeerfinished then return nil, "not-implemented"; end
+	return sock:getpeerfinished();
 end
 
 function interface_mt:resume()