mercurial/sslutil.py
changeset 29486 a62c00f6dd04
parent 29484 53b7fc7cc2bb
child 29487 cdcb5747dc88
--- a/mercurial/sslutil.py	Sun Jul 03 22:28:24 2016 +0530
+++ b/mercurial/sslutil.py	Mon Jul 04 09:58:45 2016 -0700
@@ -432,6 +432,16 @@
 
 def _defaultcacerts(ui):
     """return path to default CA certificates or None."""
+    # The "certifi" Python package provides certificates. If it is installed,
+    # assume the user intends it to be used and use it.
+    try:
+        import certifi
+        certs = certifi.where()
+        ui.debug('using ca certificates from certifi\n')
+        return certs
+    except ImportError:
+        pass
+
     if _plainapplepython():
         dummycert = os.path.join(os.path.dirname(__file__), 'dummycert.pem')
         if os.path.exists(dummycert):