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
tags/2014.2.4
Kirill Zaitsev 3 years ago
parent
commit
7a6faa63b8
1 changed files with 9 additions and 8 deletions
  1. 9
    8
      murano/common/wsgi.py

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

@@ -44,7 +44,7 @@ from murano.openstack.common import service
44 44
 from murano.openstack.common import sslutils
45 45
 from murano.openstack.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
 
@@ -155,6 +155,7 @@ class Service(service.Service):
155 155
     def _run(self, application, socket):
156 156
         """Start a WSGI server in a new green thread."""
157 157
         logger = logging.getLogger('eventlet.wsgi')
158
+        eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line
158 159
         eventlet.wsgi.server(socket,
159 160
                              application,
160 161
                              custom_pool=self.tg.pool,

Loading…
Cancel
Save