Browse Source

Raise the default max header to accommodate large tokens

PKI tokens hit the default limit if there is enough
services defined in the keystone catalog.

So sahara should allow users to customize max header size and
also increase the default value from 8192 to 16384.

Change-Id: If3daff1ba18f7fcd4cf3b7d9b4152b551d8ad277
Closes-Bug: 1190149
tags/2015.1.0rc1
Deliang Fan 4 years ago
parent
commit
07dc4fd895
2 changed files with 15 additions and 1 deletions
  1. 3
    1
      sahara/config.py
  2. 12
    0
      sahara/utils/wsgi.py

+ 3
- 1
sahara/config.py View File

@@ -133,6 +133,7 @@ def list_opts():
133 133
     from sahara.utils.openstack import nova
134 134
     from sahara.utils.openstack import swift
135 135
     from sahara.utils import proxy
136
+    from sahara.utils import wsgi
136 137
 
137 138
     return [
138 139
         (None,
@@ -150,7 +151,8 @@ def list_opts():
150 151
                          periodic.periodic_opts,
151 152
                          volumes.opts,
152 153
                          proxy.opts,
153
-                         cpo.event_log_opts)),
154
+                         cpo.event_log_opts,
155
+                         wsgi.wsgi_opts)),
154 156
         (api.conductor_group.name,
155 157
          itertools.chain(api.conductor_opts)),
156 158
         (cinder.cinder_group.name,

+ 12
- 0
sahara/utils/wsgi.py View File

@@ -42,7 +42,18 @@ from sahara.i18n import _LI
42 42
 from sahara.openstack.common import sslutils
43 43
 
44 44
 LOG = logging.getLogger(__name__)
45
+
46
+wsgi_opts = [
47
+    cfg.IntOpt('max_header_line',
48
+               default=16384,
49
+               help="Maximum line size of message headers to be accepted. "
50
+                    "max_header_line may need to be increased when using "
51
+                    "large tokens (typically those generated by the "
52
+                    "Keystone v3 API with big service catalogs)."),
53
+]
54
+
45 55
 CONF = cfg.CONF
56
+CONF.register_opts(wsgi_opts)
46 57
 
47 58
 
48 59
 class ProtectedExpatParser(expatreader.ExpatParser):
@@ -328,6 +339,7 @@ class Server(object):
328 339
     """Server class to manage multiple WSGI sockets and applications."""
329 340
 
330 341
     def __init__(self, threads=500):
342
+        eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line
331 343
         self.threads = threads
332 344
         self.children = []
333 345
         self.running = True

Loading…
Cancel
Save