mercurial/sslutil.py
branchstable
changeset 46786 52528570312e
parent 46785 521ac0d7047f
child 46819 d4ba4d51f85f
equal deleted inserted replaced
46785:521ac0d7047f 46786: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