1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-25 09:30:31 +00:00

Merge remote-tracking branch 'ssl/verify-ssl-paths'

This commit is contained in:
Ozzieisaacs 2018-11-17 16:58:05 +01:00
commit a2b612c9ab

View File

@ -32,9 +32,14 @@ class server:
def start_gevent(self): def start_gevent(self):
try: try:
ssl_args = dict() ssl_args = dict()
if web.ub.config.get_config_certfile() and web.ub.config.get_config_keyfile(): certfile_path = web.ub.config.get_config_certfile()
ssl_args = {"certfile": web.ub.config.get_config_certfile(), keyfile_path = web.ub.config.get_config_keyfile()
"keyfile": web.ub.config.get_config_keyfile()} if certfile_path and keyfile_path:
if os.path.isfile(certfile_path) and os.path.isfile(keyfile_path):
ssl_args = {"certfile": certfile_path,
"keyfile": keyfile_path}
else:
web.app.logger.info('The specified paths for the ssl certificate file and/or key file seem to be broken. Ignoring ssl. Cert path: %s | Key path: %s' % (certfile_path, keyfile_path))
if os.name == 'nt': if os.name == 'nt':
self.wsgiserver= WSGIServer(('0.0.0.0', web.ub.config.config_port), web.app, spawn=Pool(), **ssl_args) self.wsgiserver= WSGIServer(('0.0.0.0', web.ub.config.config_port), web.app, spawn=Pool(), **ssl_args)
else: else:
@ -60,12 +65,17 @@ class server:
self.start_gevent() self.start_gevent()
else: else:
try: try:
ssl = None
web.app.logger.info('Starting Tornado server') web.app.logger.info('Starting Tornado server')
if web.ub.config.get_config_certfile() and web.ub.config.get_config_keyfile(): certfile_path = web.ub.config.get_config_certfile()
ssl={"certfile": web.ub.config.get_config_certfile(), keyfile_path = web.ub.config.get_config_keyfile()
"keyfile": web.ub.config.get_config_keyfile()} if certfile_path and keyfile_path:
else: if os.path.isfile(certfile_path) and os.path.isfile(keyfile_path):
ssl=None ssl = {"certfile": certfile_path,
"keyfile": keyfile_path}
else:
web.app.logger.info('The specified paths for the ssl certificate file and/or key file seem to be broken. Ignoring ssl. Cert path: %s | Key path: %s' % (certfile_path, keyfile_path))
# Max Buffersize set to 200MB # Max Buffersize set to 200MB
http_server = HTTPServer(WSGIContainer(web.app), http_server = HTTPServer(WSGIContainer(web.app),
max_buffer_size = 209700000, max_buffer_size = 209700000,