diff --git a/swift/proxy/controllers/obj.py b/swift/proxy/controllers/obj.py index a28e60eaa3..24154d7e7e 100644 --- a/swift/proxy/controllers/obj.py +++ b/swift/proxy/controllers/obj.py @@ -3085,6 +3085,12 @@ class ECObjectController(BaseObjectController): if resp.status_int == HTTP_REQUESTED_RANGE_NOT_SATISFIABLE: resp.headers['Content-Range'] = 'bytes */%s' % resp.headers[ 'X-Object-Sysmeta-Ec-Content-Length'] + ec_headers = [header for header in resp.headers + if header.lower().startswith('x-object-sysmeta-ec-')] + for header in ec_headers: + # clients (including middlewares) shouldn't need to care about + # this implementation detail + del resp.headers[header] def _fix_ranges(self, req, resp): # Has to be called *before* kickoff()! diff --git a/test/unit/proxy/controllers/test_obj.py b/test/unit/proxy/controllers/test_obj.py index 083d3784ec..e6e42a465c 100644 --- a/test/unit/proxy/controllers/test_obj.py +++ b/test/unit/proxy/controllers/test_obj.py @@ -2307,12 +2307,17 @@ class TestECObjController(ECObjectControllerMixin, unittest.TestCase): def test_GET_simple(self): req = swift.common.swob.Request.blank('/v1/a/c/o') get_statuses = [200] * self.policy.ec_ndata - get_hdrs = [{'Connection': 'close'}] * self.policy.ec_ndata + get_hdrs = [{ + 'Connection': 'close', + 'X-Object-Sysmeta-Ec-Scheme': self.policy.ec_scheme_description, + }] * self.policy.ec_ndata with set_http_connect(*get_statuses, headers=get_hdrs): resp = req.get_response(self.app) self.assertEqual(resp.status_int, 200) self.assertIn('Accept-Ranges', resp.headers) self.assertNotIn('Connection', resp.headers) + self.assertFalse([h for h in resp.headers + if h.lower().startswith('x-object-sysmeta-ec-')]) def test_GET_not_found_when_404_newer(self): # if proxy receives a 404, it keeps waiting for other connections until