Merge "Remove duplicated 'User-Agent' header from object-updater's requests"
This commit is contained in:
commit
98a635b242
@ -29,6 +29,7 @@ from swift.common.ring import Ring
|
||||
from swift.common.utils import get_logger, renamer, write_pickle, \
|
||||
dump_recon_cache, config_true_value, ismount
|
||||
from swift.common.daemon import Daemon
|
||||
from swift.common.header_key_dict import HeaderKeyDict
|
||||
from swift.common.storage_policy import split_policy_string, PolicyError
|
||||
from swift.obj.diskfile import get_tmp_dir, ASYNCDIR_BASE
|
||||
from swift.common.http import is_success, HTTP_NOT_FOUND, \
|
||||
@ -219,7 +220,7 @@ class ObjectUpdater(Daemon):
|
||||
update['account'], update['container'])
|
||||
obj = '/%s/%s/%s' % \
|
||||
(update['account'], update['container'], update['obj'])
|
||||
headers_out = update['headers'].copy()
|
||||
headers_out = HeaderKeyDict(update['headers'])
|
||||
headers_out['user-agent'] = 'object-updater %s' % os.getpid()
|
||||
headers_out.setdefault('X-Backend-Storage-Policy-Index',
|
||||
str(int(policy)))
|
||||
|
@ -1019,8 +1019,8 @@ class TestObjectController(unittest.TestCase):
|
||||
self.assertEqual((node, 99, 'PUT', '/a/c/o'),
|
||||
mock_update.call_args_list[0][0][0:4])
|
||||
actual_headers = mock_update.call_args_list[0][0][4]
|
||||
self.assertTrue(
|
||||
actual_headers.pop('user-agent').startswith('object-updater'))
|
||||
# User-Agent is updated.
|
||||
expected_post_headers['User-Agent'] = 'object-updater %s' % os.getpid()
|
||||
self.assertDictEqual(expected_post_headers, actual_headers)
|
||||
self.assertFalse(
|
||||
os.listdir(os.path.join(
|
||||
|
Loading…
Reference in New Issue
Block a user