commit 5220451b7302fe98c2234ceaa08dbbc5040c8c94
parent 45b6afe190f5a9c8c143f5b6156673ecf9d6c2d4
Author: SomberNight <somber.night@protonmail.com>
Date: Fri, 22 Jun 2018 18:01:55 +0200
fix #4457
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/interface.py b/lib/interface.py
@@ -149,7 +149,11 @@ class TcpConnection(threading.Thread, util.PrintError):
except:
return
- if s and self.check_host_name(s.getpeercert(), self.host):
+ 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
# get server certificate.
@@ -166,7 +170,10 @@ class TcpConnection(threading.Thread, util.PrintError):
except:
return
- dercert = s.getpeercert(True)
+ try:
+ dercert = s.getpeercert(True)
+ except OSError:
+ return
s.close()
cert = ssl.DER_cert_to_PEM_cert(dercert)
# workaround android bug