changeset 22574:a00a7951b20c

ssl: refactor sslkwargs - move things around a bit, preparing for next change
author Mads Kiilerich <madski@unity3d.com>
date Fri, 26 Sep 2014 02:19:47 +0200
parents f528bfb25b45
children d7f7f1860f00
files mercurial/sslutil.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sslutil.py	Fri Sep 19 18:43:53 2014 -0700
+++ b/mercurial/sslutil.py	Fri Sep 26 02:19:47 2014 +0200
@@ -89,16 +89,18 @@
 # busted on those versions.
 
 def sslkwargs(ui, host):
-    cacerts = ui.config('web', 'cacerts')
     forcetls = ui.configbool('ui', 'tls', default=True)
     if forcetls:
         ssl_version = PROTOCOL_TLSv1
     else:
         ssl_version = PROTOCOL_SSLv23
-    hostfingerprint = ui.config('hostfingerprints', host)
     kws = {'ssl_version': ssl_version,
            }
-    if cacerts and not hostfingerprint:
+    hostfingerprint = ui.config('hostfingerprints', host)
+    if hostfingerprint:
+        return kws
+    cacerts = ui.config('web', 'cacerts')
+    if cacerts:
         cacerts = util.expandpath(cacerts)
         if not os.path.exists(cacerts):
             raise util.Abort(_('could not find web.cacerts: %s') % cacerts)