mercurial/sslutil.py
changeset 15817 8f377751b510
parent 15816 4bb59919c905
child 15997 a45516cb8d9f
--- a/mercurial/sslutil.py	Mon Jan 09 14:43:25 2012 +0100
+++ b/mercurial/sslutil.py	Mon Jan 09 14:56:05 2012 +0100
@@ -113,6 +113,9 @@
         if not sock.cipher(): # work around http://bugs.python.org/issue13721
             raise util.Abort(_('%s ssl connection error') % host)
         peercert = sock.getpeercert(True)
+        if not peercert:
+            raise util.Abort(_('%s certificate error: '
+                               'no certificate received') % host)
         peerfingerprint = util.sha1(peercert).hexdigest()
         nicefingerprint = ":".join([peerfingerprint[x:x + 2]
             for x in xrange(0, len(peerfingerprint), 2)])