##// 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 self.ui.warn(_("warning: certificate for %s can't be verified "
111 self.ui.warn(_("warning: certificate for %s can't be verified "
112 "(Python too old)\n") % host)
112 "(Python too old)\n") % host)
113 return
113 return
114
114 if not sock.cipher(): # work around http://bugs.python.org/issue13721
115 if not sock.cipher(): # work around http://bugs.python.org/issue13721
115 raise util.Abort(_('%s ssl connection error') % host)
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 if not peercert:
123 if not peercert:
118 raise util.Abort(_('%s certificate error: '
124 raise util.Abort(_('%s certificate error: '
119 'no certificate received') % host)
125 'no certificate received') % host)
@@ -129,7 +135,7 b' class validator(object):'
129 self.ui.debug('%s certificate matched fingerprint %s\n' %
135 self.ui.debug('%s certificate matched fingerprint %s\n' %
130 (host, nicefingerprint))
136 (host, nicefingerprint))
131 elif cacerts:
137 elif cacerts:
132 msg = _verifycert(sock.getpeercert(), host)
138 msg = _verifycert(peercert2, host)
133 if msg:
139 if msg:
134 raise util.Abort(_('%s certificate error: %s') % (host, msg),
140 raise util.Abort(_('%s certificate error: %s') % (host, msg),
135 hint=_('configure hostfingerprint %s or use '
141 hint=_('configure hostfingerprint %s or use '
General Comments 0
You need to be logged in to leave comments. Login now