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
This commit is contained in:
Kirill Zaitsev 2015-07-18 02:24:51 +03:00
parent bdf33cb912
commit 20756379cd
2 changed files with 10 additions and 9 deletions

View File

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

View File

@ -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,
])),
]