Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/sslutil.py @ 46414:52528570312e stable
typing: disable module attribute warnings for properly conditionalized code
Differential Revision: https://phab.mercurial-scm.org/D10208
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 13 Mar 2021 00:40:46 -0500 |
parents | 521ac0d7047f |
children | d4ba4d51f85f |
comparison
equal
deleted
inserted
replaced
46413:521ac0d7047f | 46414:52528570312e |
---|---|
541 sslcontext.options |= getattr(ssl, 'OP_SINGLE_ECDH_USE', 0) | 541 sslcontext.options |= getattr(ssl, 'OP_SINGLE_ECDH_USE', 0) |
542 | 542 |
543 # Use the list of more secure ciphers if found in the ssl module. | 543 # Use the list of more secure ciphers if found in the ssl module. |
544 if util.safehasattr(ssl, b'_RESTRICTED_SERVER_CIPHERS'): | 544 if util.safehasattr(ssl, b'_RESTRICTED_SERVER_CIPHERS'): |
545 sslcontext.options |= getattr(ssl, 'OP_CIPHER_SERVER_PREFERENCE', 0) | 545 sslcontext.options |= getattr(ssl, 'OP_CIPHER_SERVER_PREFERENCE', 0) |
546 # pytype: disable=module-attr | |
546 sslcontext.set_ciphers(ssl._RESTRICTED_SERVER_CIPHERS) | 547 sslcontext.set_ciphers(ssl._RESTRICTED_SERVER_CIPHERS) |
548 # pytype: enable=module-attr | |
547 | 549 |
548 if requireclientcert: | 550 if requireclientcert: |
549 sslcontext.verify_mode = ssl.CERT_REQUIRED | 551 sslcontext.verify_mode = ssl.CERT_REQUIRED |
550 else: | 552 else: |
551 sslcontext.verify_mode = ssl.CERT_NONE | 553 sslcontext.verify_mode = ssl.CERT_NONE |