From 20756379cd07e1194543e7b09444efb3412f3db8 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 0ce5ce200..4125a823c 100644 --- a/murano/common/wsgi.py +++ b/murano/common/wsgi.py @@ -44,7 +44,7 @@ from murano.common import exceptions from murano.common.i18n import _ from murano.common import xmlutils -socket_opts = [ +wsgi_opts = [ cfg.IntOpt('backlog', default=4096, help="Number of backlog requests to configure the socket with"), @@ -52,20 +52,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. @@ -159,6 +159,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 8ed8b852c..d47211f68 100644 --- a/murano/opts.py +++ b/murano/opts.py @@ -42,7 +42,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, ])), ]