Patchwork D6343: sslutil: add support for SSLKEYLOGFILE to wrapsocket

login
register
mail settings
Submitter phabricator
Date May 10, 2019, 4:01 p.m.
Message ID <2f7ac23b8a93417e7b6477dd9a98b16b@localhost.localdomain>
Download mbox | patch
Permalink /patch/39993/
State Not Applicable
Headers show

Comments

phabricator - May 10, 2019, 4:01 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc8d55ff80da1: sslutil: add support for SSLKEYLOGFILE to wrapsocket (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6343?vs=15010&id=15048

REVISION DETAIL
  https://phab.mercurial-scm.org/D6343

AFFECTED FILES
  mercurial/sslutil.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -16,6 +16,7 @@ 
 
 from .i18n import _
 from . import (
+    encoding,
     error,
     node,
     pycompat,
@@ -348,6 +349,17 @@ 
     if not serverhostname:
         raise error.Abort(_('serverhostname argument is required'))
 
+    if b'SSLKEYLOGFILE' in encoding.environ:
+        try:
+            import sslkeylog
+            sslkeylog.set_keylog(pycompat.fsdecode(
+                encoding.environ[b'SSLKEYLOGFILE']))
+            ui.warn(
+                b'sslkeylog enabled by SSLKEYLOGFILE environment variable\n')
+        except ImportError:
+            ui.warn(b'sslkeylog module missing, '
+                    b'but SSLKEYLOGFILE set in environment\n')
+
     for f in (keyfile, certfile):
         if f and not os.path.exists(f):
             raise error.Abort(