diff --git a/swift/common/middleware/copy.py b/swift/common/middleware/copy.py index 1422d66804..34bf4f0f27 100644 --- a/swift/common/middleware/copy.py +++ b/swift/common/middleware/copy.py @@ -498,7 +498,9 @@ class ServerSideCopyMiddleware(object): source_resp.headers['X-Object-Manifest'] sink_req.params = params - # Set data source, content length and etag for the PUT request + # Set swift.source, data source, content length and etag + # for the PUT request + sink_req.environ['swift.source'] = 'SSC' sink_req.environ['wsgi.input'] = FileLikeIter(source_resp.app_iter) sink_req.content_length = source_resp.content_length if (source_resp.status_int == HTTP_OK and diff --git a/test/unit/common/middleware/test_copy.py b/test/unit/common/middleware/test_copy.py index 2dba7194ad..f6453fa29f 100644 --- a/test/unit/common/middleware/test_copy.py +++ b/test/unit/common/middleware/test_copy.py @@ -256,6 +256,8 @@ class TestServerSideCopyMiddleware(unittest.TestCase): self.assertEqual('/v1/a/c/o', self.authorized[0].path) self.assertEqual('PUT', self.authorized[1].method) self.assertEqual('/v1/a/c/o2', self.authorized[1].path) + self.assertEqual(self.app.swift_sources[0], 'SSC') + self.assertEqual(self.app.swift_sources[1], 'SSC') def test_static_large_object_manifest(self): self.app.register('GET', '/v1/a/c/o', swob.HTTPOk,