Patchwork [4,of,4] ssl: remove CERT_REQUIRED constant that was necessary for compatibility

login
register
mail settings
Submitter Yuya Nishihara
Date June 5, 2015, 2:21 p.m.
Message ID <576ea2cd1fcb8361ec50.1433514083@mimosa>
Download mbox | patch
Permalink /patch/9519/
State Accepted
Headers show

Comments

Yuya Nishihara - June 5, 2015, 2:21 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1433508344 -32400
#      Fri Jun 05 21:45:44 2015 +0900
# Node ID 576ea2cd1fcb8361ec50853727354d1da6ae63fa
# Parent  4df50cda89ce5cca2846dcef20cb485297ec8e38
ssl: remove CERT_REQUIRED constant that was necessary for compatibility
Augie Fackler - June 5, 2015, 3:32 p.m.
On Fri, Jun 05, 2015 at 11:21:23PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1433508344 -32400
> #      Fri Jun 05 21:45:44 2015 +0900
> # Node ID 576ea2cd1fcb8361ec50853727354d1da6ae63fa
> # Parent  4df50cda89ce5cca2846dcef20cb485297ec8e38
> ssl: remove CERT_REQUIRED constant that was necessary for compatibility

These all look wonderful, thanks! Queued with delight.

>
> diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
> --- a/mercurial/sslutil.py
> +++ b/mercurial/sslutil.py
> @@ -12,7 +12,6 @@ from mercurial import util
>  from mercurial.i18n import _
>
>  _canloaddefaultcerts = False
> -CERT_REQUIRED = ssl.CERT_REQUIRED
>  try:
>      ssl_context = ssl.SSLContext
>      _canloaddefaultcerts = util.safehasattr(ssl_context, 'load_default_certs')
> @@ -144,7 +143,7 @@ def sslkwargs(ui, host):
>          ui.setconfig('web', 'cacerts', cacerts, 'defaultcacerts')
>      if cacerts != '!':
>          kws.update({'ca_certs': cacerts,
> -                    'cert_reqs': CERT_REQUIRED,
> +                    'cert_reqs': ssl.CERT_REQUIRED,
>                      })
>      return kws
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -12,7 +12,6 @@  from mercurial import util
 from mercurial.i18n import _
 
 _canloaddefaultcerts = False
-CERT_REQUIRED = ssl.CERT_REQUIRED
 try:
     ssl_context = ssl.SSLContext
     _canloaddefaultcerts = util.safehasattr(ssl_context, 'load_default_certs')
@@ -144,7 +143,7 @@  def sslkwargs(ui, host):
         ui.setconfig('web', 'cacerts', cacerts, 'defaultcacerts')
     if cacerts != '!':
         kws.update({'ca_certs': cacerts,
-                    'cert_reqs': CERT_REQUIRED,
+                    'cert_reqs': ssl.CERT_REQUIRED,
                     })
     return kws