Browse Source

Raise max header size to accommodate large tokens

The max header is exceeded in the following scenario
- Auth tokens built with a keystone v3 API catalog
- A catalog with approximately 8 or more endpoints defined

An equivalent fix will be required for all projects which use
eventlet.wsgi.

Closes-Bug: #1190149

Change-Id: Ia0882e43395f1025137173b51aab147433b54255
tags/2014.1.b3
lvdongbing 5 years ago
parent
commit
4df858db82
3 changed files with 15 additions and 2 deletions
  1. 6
    0
      etc/trove/trove.conf.sample
  2. 5
    0
      trove/common/cfg.py
  3. 4
    2
      trove/common/wsgi.py

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

@@ -33,6 +33,12 @@ sql_connection = mysql://root:e1a2c042c828d3566d0a@localhost/trove
33 33
 # before MySQL can drop the connection.
34 34
 sql_idle_timeout = 3600
35 35
 
36
+# Maximum line size of message headers to be accepted.
37
+# max_header_line may need to be increased when using large tokens
38
+# (typically those generated by the Keystone v3 API with big service
39
+# catalogs)
40
+# max_header_line = 16384
41
+
36 42
 #DB Api Implementation
37 43
 db_api_implementation = "trove.db.sqlalchemy.api"
38 44
 

+ 5
- 0
trove/common/cfg.py View File

@@ -258,6 +258,11 @@ common_opts = [
258 258
                 help='List of network IDs which should be attached'
259 259
                      ' to instance when networks are not specified'
260 260
                      ' in API call.'),
261
+    cfg.IntOpt('max_header_line', default=16384,
262
+               help='Maximum line size of message headers to be accepted. '
263
+                    'max_header_line may need to be increased when using '
264
+                    'large tokens (typically those generated by the '
265
+                    'Keystone v3 API with big service catalogs'),
261 266
 ]
262 267
 
263 268
 CONF = cfg.CONF

+ 4
- 2
trove/common/wsgi.py View File

@@ -51,12 +51,14 @@ XMLDictSerializer = openstack_wsgi.XMLDictSerializer
51 51
 XMLDeserializer = openstack_wsgi.XMLDeserializer
52 52
 RequestDeserializer = openstack_wsgi.RequestDeserializer
53 53
 
54
+CONF = cfg.CONF
55
+# Raise the default from 8192 to accommodate large tokens
56
+eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line
57
+
54 58
 eventlet.patcher.monkey_patch(all=False, socket=True)
55 59
 
56 60
 LOG = logging.getLogger('trove.common.wsgi')
57 61
 
58
-CONF = cfg.CONF
59
-
60 62
 XMLNS = 'http://docs.openstack.org/database/api/v1.0'
61 63
 CUSTOM_PLURALS_METADATA = {'databases': '', 'users': ''}
62 64
 CUSTOM_SERIALIZER_METADATA = {

Loading…
Cancel
Save