[PATCH] ui: optionally quiesce ssl verification warnings on python 2.5

Steven Stallion sstallion at gmail.com
Mon Apr 9 16:36:36 CDT 2012


# HG changeset patch
# User Steven Stallion <sstallion at gmail.com>
# Date 1334007376 25200
# Node ID 454e9066b768edf9a18d701e1f2e3b045af10573
# Parent  329887a7074c8e49e73fa76712d8d45aee0d0fd7
ui: optionally quiesce ssl verification warnings on python 2.5

Some platforms, notably Plan 9 from Bell Labs are stuck on older
releases of Python. Due to restrictions in the platform, it is not
possible to backport the SSL library to the existing Python port.
This patch permits the UI to quiesce SSL verification warnings by
adding a configuration entry named reportoldssl to ui.

diff -r 329887a7074c -r 454e9066b768 mercurial/help/config.txt
--- a/mercurial/help/config.txt	Fri Apr 06 15:18:14 2012 -0500
+++ b/mercurial/help/config.txt	Mon Apr 09 14:36:16 2012 -0700
@@ -1130,6 +1130,10 @@
 ``remotecmd``
     remote command to use for clone/push/pull operations. Default is ``hg``.
 
+``reportoldssl``
+    Warn if an SSL certificate is unable to be verified when using Python
+    2.5 or earlier. True or False. Default is True.
+
 ``report_untrusted``
     Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
     trusted user or group. True or False. Default is True.
diff -r 329887a7074c -r 454e9066b768 mercurial/sslutil.py
--- a/mercurial/sslutil.py	Fri Apr 06 15:18:14 2012 -0500
+++ b/mercurial/sslutil.py	Mon Apr 09 14:36:16 2012 -0700
@@ -107,8 +107,9 @@
             if hostfingerprint:
                 raise util.Abort(_("host fingerprint for %s can't be "
                                    "verified (Python too old)") % host)
-            self.ui.warn(_("warning: certificate for %s can't be verified "
-                           "(Python too old)\n") % host)
+            if self.ui.configbool('ui', 'reportoldssl', True):
+                self.ui.warn(_("warning: certificate for %s can't be verified "
+                               "(Python too old)\n") % host)
             return
         if not sock.cipher(): # work around http://bugs.python.org/issue13721
             raise util.Abort(_('%s ssl connection error') % host)


More information about the Mercurial-devel mailing list