From 6a2449ffaf1f21ae9b3b121e0f2725a32aab1117 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Sat, 31 Mar 2018 20:19:37 +0200 Subject: [PATCH] Fix for SSL/NonSSL and gevent --- cps/web.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/cps/web.py b/cps/web.py index 93b729eb..d57c5882 100755 --- a/cps/web.py +++ b/cps/web.py @@ -3331,21 +3331,15 @@ def start_gevent(): from gevent.wsgi import WSGIServer global gevent_server try: - if ub.config.get_config_certfile() and ub.get_config_keyfile(): - keyfile = ub.config.get_config_certfile() - certfile = ub.config.get_config_keyfile() - else: - keyfile = None - certfile = None - gevent_server = WSGIServer(('', ub.config.config_port), app, - keyfile = keyfile, - certfile = certfile) + ssl_args=dict() + if ub.config.get_config_certfile() and ub.config.get_config_keyfile(): + ssl_args = {"certfile": ub.config.get_config_certfile(), + "keyfile": ub.config.get_config_keyfile()} + gevent_server = WSGIServer(('', ub.config.config_port), app, **ssl_args) gevent_server.serve_forever() except SocketError: app.logger.info('Unable to listen on \'\', trying on IPv4 only...') - gevent_server = WSGIServer(('0.0.0.0', ub.config.config_port), app, - keyfile = keyfile, - certfile = certfile) + gevent_server = WSGIServer(('0.0.0.0', ub.config.config_port), app, **ssl_args) gevent_server.serve_forever() except: pass