equal
deleted
inserted
replaced
14 import re |
14 import re |
15 import ssl |
15 import ssl |
16 |
16 |
17 from .i18n import _ |
17 from .i18n import _ |
18 from . import ( |
18 from . import ( |
|
19 encoding, |
19 error, |
20 error, |
20 node, |
21 node, |
21 pycompat, |
22 pycompat, |
22 util, |
23 util, |
23 ) |
24 ) |
345 server (and client) support SNI, this tells the server which certificate |
346 server (and client) support SNI, this tells the server which certificate |
346 to use. |
347 to use. |
347 """ |
348 """ |
348 if not serverhostname: |
349 if not serverhostname: |
349 raise error.Abort(_('serverhostname argument is required')) |
350 raise error.Abort(_('serverhostname argument is required')) |
|
351 |
|
352 if b'SSLKEYLOGFILE' in encoding.environ: |
|
353 try: |
|
354 import sslkeylog |
|
355 sslkeylog.set_keylog(pycompat.fsdecode( |
|
356 encoding.environ[b'SSLKEYLOGFILE'])) |
|
357 ui.warn( |
|
358 b'sslkeylog enabled by SSLKEYLOGFILE environment variable\n') |
|
359 except ImportError: |
|
360 ui.warn(b'sslkeylog module missing, ' |
|
361 b'but SSLKEYLOGFILE set in environment\n') |
350 |
362 |
351 for f in (keyfile, certfile): |
363 for f in (keyfile, certfile): |
352 if f and not os.path.exists(f): |
364 if f and not os.path.exists(f): |
353 raise error.Abort( |
365 raise error.Abort( |
354 _('certificate file (%s) does not exist; cannot connect to %s') |
366 _('certificate file (%s) does not exist; cannot connect to %s') |