From 99a727e346172f73da6cc6a23edee87348b8a100 Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Sat, 18 Jul 2015 02:24:51 +0300 Subject: [PATCH] Allow setting eventlet.wsgi.MAX_HEADER_LINE This commit allows setting wsgi MAX_HEADER_LINE. This is done to allow large keystone tokens. Also removes seeimngly unused run_server function, to not cause confustion. Change-Id: I2848c08d0758f39cb988079a8fabf36d6d2a2c98 Closes-Bug: #1190149 --- murano/common/wsgi.py | 17 +++++++++-------- murano/opts.py | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/murano/common/wsgi.py b/murano/common/wsgi.py index b641ba6b2..2dc3f6880 100644 --- a/murano/common/wsgi.py +++ b/murano/common/wsgi.py @@ -43,7 +43,7 @@ from murano.openstack.common import log as logging from murano.openstack.common import service from murano.openstack.common import sslutils -socket_opts = [ +wsgi_opts = [ cfg.IntOpt('backlog', default=4096, help="Number of backlog requests to configure the socket with"), @@ -51,20 +51,20 @@ socket_opts = [ default=600, help="Sets the value of TCP_KEEPIDLE in seconds for each " "server socket. Not supported on OS X."), + cfg.IntOpt('max_header_line', + default=16384, + help="Maximum line size of message headers to be accepted. " + "max_header_line may need to be increased when using " + "large tokens (typically those generated by the " + "Keystone v3 API with big service catalogs)."), ] CONF = cfg.CONF -CONF.register_opts(socket_opts) +CONF.register_opts(wsgi_opts) LOG = logging.getLogger(__name__) -def run_server(application, port): - """Run a WSGI server with the given application.""" - sock = eventlet.listen(('0.0.0.0', port)) - eventlet.wsgi.server(sock, application) - - class Service(service.Service): """Provides a Service API for wsgi servers. @@ -154,6 +154,7 @@ class Service(service.Service): def _run(self, application, socket): """Start a WSGI server in a new green thread.""" logger = logging.getLogger('eventlet.wsgi') + eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line eventlet.wsgi.server(socket, application, custom_pool=self.tg.pool, diff --git a/murano/opts.py b/murano/opts.py index e34e4c0be..4e47a2063 100644 --- a/murano/opts.py +++ b/murano/opts.py @@ -45,7 +45,7 @@ _opt_lists = [ murano.common.config.metadata_dir, murano.common.config.bind_opts, murano.common.config.file_server, - murano.common.wsgi.socket_opts, + murano.common.wsgi.wsgi_opts, murano.openstack.common.log.common_cli_opts, murano.openstack.common.log.generic_log_opts, murano.openstack.common.log.log_opts,