Fix for SSL/NonSSL and gevent

pull/495/head
OzzieIsaacs 7 years ago
parent 691a4a88e6
commit 6a2449ffaf

@ -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

Loading…
Cancel
Save