--- a/mercurial/sslutil.py Mon Oct 05 22:49:24 2015 -0700
+++ b/mercurial/sslutil.py Thu Oct 08 12:55:45 2015 -0700
@@ -14,7 +14,7 @@
import sys
from .i18n import _
-from . import util
+from . import error, util
_canloaddefaultcerts = False
try:
@@ -50,7 +50,7 @@
# closed
# - see http://bugs.python.org/issue13721
if not sslsocket.cipher():
- raise util.Abort(_('ssl connection failed'))
+ raise error.Abort(_('ssl connection failed'))
return sslsocket
except AttributeError:
def wrapsocket(sock, keyfile, certfile, ui, cert_reqs=ssl.CERT_NONE,
@@ -62,7 +62,7 @@
# closed
# - see http://bugs.python.org/issue13721
if not sslsocket.cipher():
- raise util.Abort(_('ssl connection failed'))
+ raise error.Abort(_('ssl connection failed'))
return sslsocket
def _verifycert(cert, hostname):
@@ -140,7 +140,7 @@
elif cacerts:
cacerts = util.expandpath(cacerts)
if not os.path.exists(cacerts):
- raise util.Abort(_('could not find web.cacerts: %s') % cacerts)
+ raise error.Abort(_('could not find web.cacerts: %s') % cacerts)
else:
cacerts = _defaultcacerts()
if cacerts and cacerts != '!':
@@ -163,15 +163,15 @@
hostfingerprint = self.ui.config('hostfingerprints', host)
if not sock.cipher(): # work around http://bugs.python.org/issue13721
- raise util.Abort(_('%s ssl connection error') % host)
+ raise error.Abort(_('%s ssl connection error') % host)
try:
peercert = sock.getpeercert(True)
peercert2 = sock.getpeercert()
except AttributeError:
- raise util.Abort(_('%s ssl connection error') % host)
+ raise error.Abort(_('%s ssl connection error') % host)
if not peercert:
- raise util.Abort(_('%s certificate error: '
+ raise error.Abort(_('%s certificate error: '
'no certificate received') % host)
peerfingerprint = util.sha1(peercert).hexdigest()
nicefingerprint = ":".join([peerfingerprint[x:x + 2]
@@ -179,7 +179,7 @@
if hostfingerprint:
if peerfingerprint.lower() != \
hostfingerprint.replace(':', '').lower():
- raise util.Abort(_('certificate for %s has unexpected '
+ raise error.Abort(_('certificate for %s has unexpected '
'fingerprint %s') % (host, nicefingerprint),
hint=_('check hostfingerprint configuration'))
self.ui.debug('%s certificate matched fingerprint %s\n' %
@@ -187,13 +187,13 @@
elif cacerts != '!':
msg = _verifycert(peercert2, host)
if msg:
- raise util.Abort(_('%s certificate error: %s') % (host, msg),
+ raise error.Abort(_('%s certificate error: %s') % (host, msg),
hint=_('configure hostfingerprint %s or use '
'--insecure to connect insecurely') %
nicefingerprint)
self.ui.debug('%s certificate successfully verified\n' % host)
elif strict:
- raise util.Abort(_('%s certificate with fingerprint %s not '
+ raise error.Abort(_('%s certificate with fingerprint %s not '
'verified') % (host, nicefingerprint),
hint=_('check hostfingerprints or web.cacerts '
'config setting'))