Browse Source

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
Kirill Zaitsev 3 years ago
parent
commit
20756379cd
2 changed files with 10 additions and 9 deletions
  1. 9
    8
      murano/common/wsgi.py
  2. 1
    1
      murano/opts.py

+ 9
- 8
murano/common/wsgi.py View File

@@ -44,7 +44,7 @@ from murano.common import exceptions
44 44
 from murano.common.i18n import _
45 45
 from murano.common import xmlutils
46 46
 
47
-socket_opts = [
47
+wsgi_opts = [
48 48
     cfg.IntOpt('backlog',
49 49
                default=4096,
50 50
                help="Number of backlog requests to configure the socket with"),
@@ -52,20 +52,20 @@ socket_opts = [
52 52
                default=600,
53 53
                help="Sets the value of TCP_KEEPIDLE in seconds for each "
54 54
                     "server socket. Not supported on OS X."),
55
+    cfg.IntOpt('max_header_line',
56
+               default=16384,
57
+               help="Maximum line size of message headers to be accepted. "
58
+                    "max_header_line may need to be increased when using "
59
+                    "large tokens (typically those generated by the "
60
+                    "Keystone v3 API with big service catalogs)."),
55 61
 ]
56 62
 
57 63
 CONF = cfg.CONF
58
-CONF.register_opts(socket_opts)
64
+CONF.register_opts(wsgi_opts)
59 65
 
60 66
 LOG = logging.getLogger(__name__)
61 67
 
62 68
 
63
-def run_server(application, port):
64
-    """Run a WSGI server with the given application."""
65
-    sock = eventlet.listen(('0.0.0.0', port))
66
-    eventlet.wsgi.server(sock, application)
67
-
68
-
69 69
 class Service(service.Service):
70 70
     """Provides a Service API for wsgi servers.
71 71
 
@@ -159,6 +159,7 @@ class Service(service.Service):
159 159
     def _run(self, application, socket):
160 160
         """Start a WSGI server in a new green thread."""
161 161
         logger = logging.getLogger('eventlet.wsgi')
162
+        eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line
162 163
         eventlet.wsgi.server(socket,
163 164
                              application,
164 165
                              custom_pool=self.tg.pool,

+ 1
- 1
murano/opts.py View File

@@ -42,7 +42,7 @@ _opt_lists = [
42 42
         murano.common.config.metadata_dir,
43 43
         murano.common.config.bind_opts,
44 44
         murano.common.config.file_server,
45
-        murano.common.wsgi.socket_opts,
45
+        murano.common.wsgi.wsgi_opts,
46 46
     ])),
47 47
 ]
48 48
 

Loading…
Cancel
Save