Merge pull request #39554 from DSRCorporation/bugs/ssl_bool

Cosmetic: support bool value for 'ssl' config option.
This commit is contained in:
Mike Place 2017-02-22 09:59:02 -07:00 committed by GitHub
commit 56fe2f198e

View file

@ -932,7 +932,7 @@ VALID_OPTS = {
# http://docs.python.org/2/library/ssl.html#ssl.wrap_socket
# Note: to set enum arguments values like `cert_reqs` and `ssl_version` use constant names
# without ssl module prefix: `CERT_REQUIRED` or `PROTOCOL_SSLv23`.
'ssl': (dict, type(None)),
'ssl': (dict, bool, type(None)),
# django auth
'django_auth_path': str,
@ -3106,7 +3106,11 @@ def _update_ssl_config(opts):
'''
Resolves string names to integer constant in ssl configuration.
'''
if opts['ssl'] is None:
if opts['ssl'] in (None, False):
opts['ssl'] = None
return
if opts['ssl'] is True:
opts['ssl'] = {}
return
import ssl
for key, prefix in (('cert_reqs', 'CERT_'),