Fix for SSL/NonSSL and gevent

This commit is contained in:
OzzieIsaacs 2018-03-31 20:19:37 +02:00
parent 691a4a88e6
commit 6a2449ffaf

View File

@ -3331,21 +3331,15 @@ def start_gevent():
from gevent.wsgi import WSGIServer from gevent.wsgi import WSGIServer
global gevent_server global gevent_server
try: try:
if ub.config.get_config_certfile() and ub.get_config_keyfile(): ssl_args=dict()
keyfile = ub.config.get_config_certfile() if ub.config.get_config_certfile() and ub.config.get_config_keyfile():
certfile = ub.config.get_config_keyfile() ssl_args = {"certfile": ub.config.get_config_certfile(),
else: "keyfile": ub.config.get_config_keyfile()}
keyfile = None gevent_server = WSGIServer(('', ub.config.config_port), app, **ssl_args)
certfile = None
gevent_server = WSGIServer(('', ub.config.config_port), app,
keyfile = keyfile,
certfile = certfile)
gevent_server.serve_forever() gevent_server.serve_forever()
except SocketError: except SocketError:
app.logger.info('Unable to listen on \'\', trying on IPv4 only...') app.logger.info('Unable to listen on \'\', trying on IPv4 only...')
gevent_server = WSGIServer(('0.0.0.0', ub.config.config_port), app, gevent_server = WSGIServer(('0.0.0.0', ub.config.config_port), app, **ssl_args)
keyfile = keyfile,
certfile = certfile)
gevent_server.serve_forever() gevent_server.serve_forever()
except: except:
pass pass