Merge "Always pass capitalize_response_headers=False to eventlet.wsgi.server()"

This commit is contained in:
Zuul 2018-05-25 21:30:35 +00:00 committed by Gerrit Code Review
commit eafe6e63bf
2 changed files with 7 additions and 14 deletions

View File

@ -18,7 +18,6 @@
from __future__ import print_function
import errno
import inspect
import os
import signal
import time
@ -543,12 +542,11 @@ def run_server(conf, logger, sock, global_conf=None):
server_kwargs = {
'custom_pool': pool,
'protocol': protocol_class,
# Disable capitalizing headers in Eventlet. This is necessary for
# the AWS SDK to work with s3api middleware (it needs an "ETag"
# header; "Etag" just won't do).
'capitalize_response_headers': False,
}
# Disable capitalizing headers in Eventlet if possible. This is
# necessary for the AWS SDK to work with swift3 middleware.
argspec = inspect.getargspec(wsgi.server)
if 'capitalize_response_headers' in argspec.args:
server_kwargs['capitalize_response_headers'] = False
try:
wsgi.server(sock, app, wsgi_logger, **server_kwargs)
except socket.error as err:

View File

@ -478,8 +478,7 @@ class TestWSGI(unittest.TestCase):
with mock.patch('swift.proxy.server.Application.'
'modify_wsgi_pipeline'), \
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
mock.patch('swift.common.wsgi.eventlet') as _wsgi_evt, \
mock.patch('swift.common.wsgi.inspect'):
mock.patch('swift.common.wsgi.eventlet') as _wsgi_evt:
conf = wsgi.appconfig(conf_file)
logger = logging.getLogger('test')
sock = listen_zero()
@ -528,8 +527,7 @@ class TestWSGI(unittest.TestCase):
with mock.patch('swift.proxy.server.Application.'
'modify_wsgi_pipeline'), \
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
mock.patch('swift.common.wsgi.eventlet') as _eventlet, \
mock.patch('swift.common.wsgi.inspect'):
mock.patch('swift.common.wsgi.eventlet') as _eventlet:
conf = wsgi.appconfig(conf_file,
name='proxy-server')
logger = logging.getLogger('test')
@ -576,9 +574,7 @@ class TestWSGI(unittest.TestCase):
with mock.patch('swift.proxy.server.Application.'
'modify_wsgi_pipeline'), \
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
mock.patch('swift.common.wsgi.eventlet'), \
mock.patch('swift.common.wsgi.inspect',
getargspec=argspec_stub):
mock.patch('swift.common.wsgi.eventlet'):
conf = wsgi.appconfig(conf_file)
logger = logging.getLogger('test')
sock = listen_zero()
@ -618,7 +614,6 @@ class TestWSGI(unittest.TestCase):
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
mock.patch('swift.common.wsgi.eventlet') as _wsgi_evt, \
mock.patch.dict('os.environ', {'TZ': ''}), \
mock.patch('swift.common.wsgi.inspect'), \
mock.patch('time.tzset'):
conf = wsgi.appconfig(conf_dir)
logger = logging.getLogger('test')