dummyserver/server.py: simlify import ssl strategy
Given that large portions of the existing test base blindly import ssl,
and given that if the ssl module exists, CERT_OPTIONAL will be present,
just import ssl unconditionally and use ssl.CERT_OPTIONAL where needed.
@@ -14,13 +14,9 @@ import sys
import threading
import socket
import warnings
+import ssl
from datetime import datetime
-try:
- from ssl import CERT_OPTIONAL
-except:
- CERT_OPTIONAL = None
-
from urllib3.exceptions import HTTPWarning
from tornado.platform.auto import set_close_exec
@@ -35,7 +31,7 @@ CERTS_PATH = os.path.join(os.path.dirname(__file__), 'certs')
DEFAULT_CERTS = {
'certfile': os.path.join(CERTS_PATH, 'server.crt'),
'keyfile': os.path.join(CERTS_PATH, 'server.key'),
- 'cert_reqs': CERT_OPTIONAL,
+ 'cert_reqs': ssl.CERT_OPTIONAL,
'ca_certs': os.path.join(CERTS_PATH, 'cacert.pem'),
}
DEFAULT_CLIENT_CERTS = {
