##// END OF EJS Templates
sslutil: try harder to avoid getpeercert problems...
Matt Mackall -
r18879:93b03a22 default
parent child Browse files
Show More
@@ -111,9 +111,15 b' class validator(object):'
111 111 self.ui.warn(_("warning: certificate for %s can't be verified "
112 112 "(Python too old)\n") % host)
113 113 return
114
114 115 if not sock.cipher(): # work around http://bugs.python.org/issue13721
115 116 raise util.Abort(_('%s ssl connection error') % host)
116 peercert = sock.getpeercert(True)
117 try:
118 peercert = sock.getpeercert(True)
119 peercert2 = sock.getpeercert()
120 except AttributeError:
121 raise util.Abort(_('%s ssl connection error') % host)
122
117 123 if not peercert:
118 124 raise util.Abort(_('%s certificate error: '
119 125 'no certificate received') % host)
@@ -129,7 +135,7 b' class validator(object):'
129 135 self.ui.debug('%s certificate matched fingerprint %s\n' %
130 136 (host, nicefingerprint))
131 137 elif cacerts:
132 msg = _verifycert(sock.getpeercert(), host)
138 msg = _verifycert(peercert2, host)
133 139 if msg:
134 140 raise util.Abort(_('%s certificate error: %s') % (host, msg),
135 141 hint=_('configure hostfingerprint %s or use '
General Comments 0
You need to be logged in to leave comments. Login now