Browse Source

Allow operators to customize max header size

HTTP messages max header line size has been increased from 8K to 16K
by default to allow using tokens including up to 14-15 catalog
entries.  The same issue
(https://bugs.launchpad.net/swift/+bug/1190149) may occur again in
the future, if keystone's catalog grows further.

Allowing operators to customize the max header size, will allow them
to have Cinder working whatever the size of the catalog (if the option
is properly set).

Change-Id: Iac269d96fadc96c1e9383dc03422f2d87196dd9d
Related-Bug: #1190149
DocImpact
tags/2014.1.b3
Florent Flament 5 years ago
parent
commit
be163cf102
2 changed files with 18 additions and 3 deletions
  1. 12
    3
      cinder/wsgi.py
  2. 6
    0
      etc/cinder/cinder.conf.sample

+ 12
- 3
cinder/wsgi.py View File

@@ -59,14 +59,21 @@ socket_opts = [
59 59
                     "the server securely"),
60 60
 ]
61 61
 
62
+eventlet_opts = [
63
+    cfg.IntOpt('max_header_line',
64
+               default=16384,
65
+               help="Maximum line size of message headers to be accepted. "
66
+                    "max_header_line may need to be increased when using "
67
+                    "large tokens (typically those generated by the "
68
+                    "Keystone v3 API with big service catalogs)."),
69
+]
70
+
62 71
 CONF = cfg.CONF
63 72
 CONF.register_opts(socket_opts)
73
+CONF.register_opts(eventlet_opts)
64 74
 
65 75
 LOG = logging.getLogger(__name__)
66 76
 
67
-# Raise the default from 8192 to accommodate large tokens
68
-eventlet.wsgi.MAX_HEADER_LINE = 16384
69
-
70 77
 
71 78
 class Server(object):
72 79
     """Server class to manage a WSGI server, serving a WSGI application."""
@@ -85,6 +92,8 @@ class Server(object):
85 92
         :returns: None
86 93
 
87 94
         """
95
+        # Allow operators to customize http requests max header line size.
96
+        eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line
88 97
         self.name = name
89 98
         self.app = app
90 99
         self._host = host or "0.0.0.0"

+ 6
- 0
etc/cinder/cinder.conf.sample View File

@@ -93,6 +93,12 @@
93 93
 # Options defined in cinder.wsgi
94 94
 #
95 95
 
96
+# Maximum line size of message headers to be accepted.
97
+# max_header_line may need to be increased when using large
98
+# tokens (typically those generated by the Keystone v3 API
99
+# with big service catalogs). (integer value)
100
+#max_header_line=16384
101
+
96 102
 # Sets the value of TCP_KEEPIDLE in seconds for each server
97 103
 # socket. Not supported on OS X. (integer value)
98 104
 #tcp_keepidle=600

Loading…
Cancel
Save