From 5f050aa13e7db9725a83fda8c6baa6f622e5e7db Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 22 Jun 2018 18:32:01 +0200 Subject: [PATCH] follow-up prev --- lib/interface.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/interface.py b/lib/interface.py index dbd41a0db..98305bb11 100644 --- a/lib/interface.py +++ b/lib/interface.py @@ -145,17 +145,16 @@ class TcpConnection(threading.Thread, util.PrintError): s = context.wrap_socket(s, do_handshake_on_connect=True) except ssl.SSLError as e: self.print_error(e) - s = None except: return - - try: - peer_cert = s.getpeercert() - except OSError: - return - if s and self.check_host_name(peer_cert, self.host): - self.print_error("SSL certificate signed by CA") - return s + else: + try: + peer_cert = s.getpeercert() + except OSError: + return + if self.check_host_name(peer_cert, self.host): + self.print_error("SSL certificate signed by CA") + return s # get server certificate. # Do not use ssl.get_server_certificate because it does not work with proxy s = self.get_simple_socket()