Comparison

net/server_epoll.lua @ 13422:3c80124452ed

net.server_epoll: Prevent traceback when checking TLS after connection gone Unclear why this would be done, but an error is not great.
author Kim Alvefur <zash@zash.se>
date Sun, 21 Jan 2024 22:59:50 +0100
parent 13336:f91761822420
child 13440:b27de3d2bad6
comparison
equal deleted inserted replaced
13421:92301fa7a673 13422:3c80124452ed
628 return self.tls_ctx 628 return self.tls_ctx
629 end 629 end
630 630
631 function interface:ssl_info() 631 function interface:ssl_info()
632 local sock = self.conn; 632 local sock = self.conn;
633 if not sock then return nil, "not-connected" end
633 if not sock.info then return nil, "not-implemented"; end 634 if not sock.info then return nil, "not-implemented"; end
634 return sock:info(); 635 return sock:info();
635 end 636 end
636 637
637 function interface:ssl_peercertificate() 638 function interface:ssl_peercertificate()
638 local sock = self.conn; 639 local sock = self.conn;
640 if not sock then return nil, "not-connected" end
639 if not sock.getpeercertificate then return nil, "not-implemented"; end 641 if not sock.getpeercertificate then return nil, "not-implemented"; end
640 return sock:getpeercertificate(); 642 return sock:getpeercertificate();
641 end 643 end
642 644
643 function interface:ssl_peerverification() 645 function interface:ssl_peerverification()
644 local sock = self.conn; 646 local sock = self.conn;
647 if not sock then return nil, "not-connected" end
645 if not sock.getpeerverification then return nil, { { "Chain verification not supported" } }; end 648 if not sock.getpeerverification then return nil, { { "Chain verification not supported" } }; end
646 return sock:getpeerverification(); 649 return sock:getpeerverification();
647 end 650 end
648 651
649 function interface:ssl_peerfinished() 652 function interface:ssl_peerfinished()
650 local sock = self.conn; 653 local sock = self.conn;
654 if not sock then return nil, "not-connected" end
651 if not sock.getpeerfinished then return nil, "not-implemented"; end 655 if not sock.getpeerfinished then return nil, "not-implemented"; end
652 return sock:getpeerfinished(); 656 return sock:getpeerfinished();
653 end 657 end
654 658
655 function interface:ssl_exportkeyingmaterial(label, len, context) 659 function interface:ssl_exportkeyingmaterial(label, len, context)
656 local sock = self.conn; 660 local sock = self.conn;
661 if not sock then return nil, "not-connected" end
657 if sock.exportkeyingmaterial then 662 if sock.exportkeyingmaterial then
658 return sock:exportkeyingmaterial(label, len, context); 663 return sock:exportkeyingmaterial(label, len, context);
659 end 664 end
660 end 665 end
661 666