|
@@ -25,7 +25,6 @@ from django.core.management.base import BaseCommand
|
|
|
|
|
|
|
|
from desktop import conf
|
|
from desktop import conf
|
|
|
from desktop.lib.daemon_utils import drop_privileges_if_necessary
|
|
from desktop.lib.daemon_utils import drop_privileges_if_necessary
|
|
|
-from django.utils.translation import ugettext as _
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CPSERVER_HELP = r"""
|
|
CPSERVER_HELP = r"""
|
|
@@ -51,7 +50,7 @@ CPSERVER_OPTIONS = {
|
|
|
|
|
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
class Command(BaseCommand):
|
|
|
- help = _("CherryPy Server for Desktop.")
|
|
|
|
|
|
|
+ help = "CherryPy Server for Desktop."
|
|
|
args = ""
|
|
args = ""
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
|
def handle(self, *args, **options):
|
|
@@ -68,7 +67,7 @@ class Command(BaseCommand):
|
|
|
except AttributeError:
|
|
except AttributeError:
|
|
|
pass
|
|
pass
|
|
|
runcpserver(args)
|
|
runcpserver(args)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
def usage(self, subcommand):
|
|
def usage(self, subcommand):
|
|
|
return CPSERVER_HELP
|
|
return CPSERVER_HELP
|
|
|
|
|
|
|
@@ -83,7 +82,7 @@ def start_server(options):
|
|
|
server = Server(
|
|
server = Server(
|
|
|
(options['host'], int(options['port'])),
|
|
(options['host'], int(options['port'])),
|
|
|
WSGIHandler(),
|
|
WSGIHandler(),
|
|
|
- int(options['threads']),
|
|
|
|
|
|
|
+ int(options['threads']),
|
|
|
options['server_name']
|
|
options['server_name']
|
|
|
)
|
|
)
|
|
|
if options['ssl_certificate'] and options['ssl_private_key']:
|
|
if options['ssl_certificate'] and options['ssl_private_key']:
|
|
@@ -93,7 +92,7 @@ def start_server(options):
|
|
|
server.ssl_certificate_chain = options['ssl_certificate_chain']
|
|
server.ssl_certificate_chain = options['ssl_certificate_chain']
|
|
|
server.ssl_cipher_list = options['ssl_cipher_list']
|
|
server.ssl_cipher_list = options['ssl_cipher_list']
|
|
|
server.ssl_no_renegotiation = options['ssl_no_renegotiation']
|
|
server.ssl_no_renegotiation = options['ssl_no_renegotiation']
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
ssl_password = conf.get_ssl_password()
|
|
ssl_password = conf.get_ssl_password()
|
|
|
if ssl_password:
|
|
if ssl_password:
|
|
|
server.ssl_password_cb = lambda *unused: ssl_password
|
|
server.ssl_password_cb = lambda *unused: ssl_password
|
|
@@ -104,7 +103,7 @@ def start_server(options):
|
|
|
|
|
|
|
|
if isinstance(server.socket, SSLConnection):
|
|
if isinstance(server.socket, SSLConnection):
|
|
|
ciphers = server.socket.get_cipher_list()
|
|
ciphers = server.socket.get_cipher_list()
|
|
|
- logging.info(_("List of enabled ciphers: {}").format(':'.join(ciphers)))
|
|
|
|
|
|
|
+ logging.info("List of enabled ciphers: {}".format(':'.join(ciphers)))
|
|
|
|
|
|
|
|
server.listen_and_loop()
|
|
server.listen_and_loop()
|
|
|
except KeyboardInterrupt:
|
|
except KeyboardInterrupt:
|
|
@@ -121,13 +120,13 @@ def runcpserver(argset=[], **kwargs):
|
|
|
else:
|
|
else:
|
|
|
k, v = x, True
|
|
k, v = x, True
|
|
|
options[k.lower()] = v
|
|
options[k.lower()] = v
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if "help" in options:
|
|
if "help" in options:
|
|
|
print(CPSERVER_HELP)
|
|
print(CPSERVER_HELP)
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
# Start the webserver
|
|
# Start the webserver
|
|
|
- logging.info(_("Starting server with options:\n{}").format(pprint.pformat(options)))
|
|
|
|
|
|
|
+ logging.info("Starting server with options:\n{}".format(pprint.pformat(options)))
|
|
|
|
|
|
|
|
start_server(options)
|
|
start_server(options)
|
|
|
|
|
|