Merge "Always pass capitalize_response_headers=False to eventlet.wsgi.server()"
This commit is contained in:
commit
eafe6e63bf
@ -18,7 +18,6 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
import inspect
|
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
import time
|
import time
|
||||||
@ -543,12 +542,11 @@ def run_server(conf, logger, sock, global_conf=None):
|
|||||||
server_kwargs = {
|
server_kwargs = {
|
||||||
'custom_pool': pool,
|
'custom_pool': pool,
|
||||||
'protocol': protocol_class,
|
'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:
|
try:
|
||||||
wsgi.server(sock, app, wsgi_logger, **server_kwargs)
|
wsgi.server(sock, app, wsgi_logger, **server_kwargs)
|
||||||
except socket.error as err:
|
except socket.error as err:
|
||||||
|
@ -478,8 +478,7 @@ class TestWSGI(unittest.TestCase):
|
|||||||
with mock.patch('swift.proxy.server.Application.'
|
with mock.patch('swift.proxy.server.Application.'
|
||||||
'modify_wsgi_pipeline'), \
|
'modify_wsgi_pipeline'), \
|
||||||
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
|
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
|
||||||
mock.patch('swift.common.wsgi.eventlet') as _wsgi_evt, \
|
mock.patch('swift.common.wsgi.eventlet') as _wsgi_evt:
|
||||||
mock.patch('swift.common.wsgi.inspect'):
|
|
||||||
conf = wsgi.appconfig(conf_file)
|
conf = wsgi.appconfig(conf_file)
|
||||||
logger = logging.getLogger('test')
|
logger = logging.getLogger('test')
|
||||||
sock = listen_zero()
|
sock = listen_zero()
|
||||||
@ -528,8 +527,7 @@ class TestWSGI(unittest.TestCase):
|
|||||||
with mock.patch('swift.proxy.server.Application.'
|
with mock.patch('swift.proxy.server.Application.'
|
||||||
'modify_wsgi_pipeline'), \
|
'modify_wsgi_pipeline'), \
|
||||||
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
|
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
|
||||||
mock.patch('swift.common.wsgi.eventlet') as _eventlet, \
|
mock.patch('swift.common.wsgi.eventlet') as _eventlet:
|
||||||
mock.patch('swift.common.wsgi.inspect'):
|
|
||||||
conf = wsgi.appconfig(conf_file,
|
conf = wsgi.appconfig(conf_file,
|
||||||
name='proxy-server')
|
name='proxy-server')
|
||||||
logger = logging.getLogger('test')
|
logger = logging.getLogger('test')
|
||||||
@ -576,9 +574,7 @@ class TestWSGI(unittest.TestCase):
|
|||||||
with mock.patch('swift.proxy.server.Application.'
|
with mock.patch('swift.proxy.server.Application.'
|
||||||
'modify_wsgi_pipeline'), \
|
'modify_wsgi_pipeline'), \
|
||||||
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
|
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
|
||||||
mock.patch('swift.common.wsgi.eventlet'), \
|
mock.patch('swift.common.wsgi.eventlet'):
|
||||||
mock.patch('swift.common.wsgi.inspect',
|
|
||||||
getargspec=argspec_stub):
|
|
||||||
conf = wsgi.appconfig(conf_file)
|
conf = wsgi.appconfig(conf_file)
|
||||||
logger = logging.getLogger('test')
|
logger = logging.getLogger('test')
|
||||||
sock = listen_zero()
|
sock = listen_zero()
|
||||||
@ -618,7 +614,6 @@ class TestWSGI(unittest.TestCase):
|
|||||||
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
|
mock.patch('swift.common.wsgi.wsgi') as _wsgi, \
|
||||||
mock.patch('swift.common.wsgi.eventlet') as _wsgi_evt, \
|
mock.patch('swift.common.wsgi.eventlet') as _wsgi_evt, \
|
||||||
mock.patch.dict('os.environ', {'TZ': ''}), \
|
mock.patch.dict('os.environ', {'TZ': ''}), \
|
||||||
mock.patch('swift.common.wsgi.inspect'), \
|
|
||||||
mock.patch('time.tzset'):
|
mock.patch('time.tzset'):
|
||||||
conf = wsgi.appconfig(conf_dir)
|
conf = wsgi.appconfig(conf_dir)
|
||||||
logger = logging.getLogger('test')
|
logger = logging.getLogger('test')
|
||||||
|
Loading…
Reference in New Issue
Block a user