Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/sslutil.py @ 33494:30f2715be123
sslutil: inform the user about how to fix an incomplete certificate chain
This is a Windows only thing. Unfortunately, the socket is closed at this point
(so the certificate is unavailable to check the chain). That means it's printed
out when verification fails as a guess, on the assumption that 1) most of the
time verification won't fail, and 2) sites using expired or certs that are too
new will be rare. Maybe this is an argument for adding more functionality to
debugssl, to test for problems and print certificate info. Or maybe it's an
argument for bundling certificates with the Windows builds. That idea was set
aside when the enhanced SSL code went in last summer, and it looks like there
were issues with using certifi on Windows anyway[1].
This was tested by deleting the certificate out of certmgr.msc > "Third-Party
Root Certification Authorities" > "Certificates", seeing `hg pull` fail (with
the new message), trying this command, and then successfully performing the pull
command.
[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-October/089573.html
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 12 Jul 2017 18:37:13 -0400 |
parents | 3bdbbadddecc |
children | 75979c8d4572 |
comparison
equal
deleted
inserted
replaced
33493:9a9f95214f46 | 33494:30f2715be123 |
---|---|
473 'communicating with this server)\n') % | 473 'communicating with this server)\n') % |
474 serverhostname) | 474 serverhostname) |
475 ui.warn(_( | 475 ui.warn(_( |
476 '(see https://mercurial-scm.org/wiki/SecureConnections ' | 476 '(see https://mercurial-scm.org/wiki/SecureConnections ' |
477 'for more info)\n')) | 477 'for more info)\n')) |
478 | |
479 elif (e.reason == 'CERTIFICATE_VERIFY_FAILED' and | |
480 pycompat.osname == 'nt'): | |
481 | |
482 ui.warn(_('(the full certificate chain may not be available ' | |
483 'locally; see "hg help debugssl")\n')) | |
478 raise | 484 raise |
479 | 485 |
480 # check if wrap_socket failed silently because socket had been | 486 # check if wrap_socket failed silently because socket had been |
481 # closed | 487 # closed |
482 # - see http://bugs.python.org/issue13721 | 488 # - see http://bugs.python.org/issue13721 |