summaryrefslogtreecommitdiff
path: root/swift/common/middleware/s3api/s3request.py
diff options
context:
space:
mode:
authorClay Gerrard <clay.gerrard@gmail.com>2022-06-15 15:27:44 -0500
committerClay Gerrard <clay.gerrard@gmail.com>2022-06-17 11:53:13 -0500
commit7a996a5c38f6c554b6a4389d3d6035cca87e922d (patch)
tree332fe8c1ba766ecbc8382cb45e2163e9f8e92e7a /swift/common/middleware/s3api/s3request.py
parent961177e6f7899d93fc17b4a9f2f5d3180d6f7c5d (diff)
downloadswift-7a996a5c38f6c554b6a4389d3d6035cca87e922d.tar.gz
Fix s3api cross policy copy
In s3api's request object we copy backend headers into the request environ for logging after we call get_response. The problem with s3api copy is that we make a pre-flight HEAD request to the source object using the same request object, so the first response backend headers pollute the request and the proxy won't over-ride the backend header with the correct storage policy. As a possible fix we simply remove the problematic header from the request object after the pre-flight HEAD request finishes. Change-Id: I40b252446b3a1294a5ca8b531f224ce9c16f9aba
Diffstat (limited to 'swift/common/middleware/s3api/s3request.py')
-rw-r--r--swift/common/middleware/s3api/s3request.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/swift/common/middleware/s3api/s3request.py b/swift/common/middleware/s3api/s3request.py
index f53d12b12..6ddc19c4b 100644
--- a/swift/common/middleware/s3api/s3request.py
+++ b/swift/common/middleware/s3api/s3request.py
@@ -916,6 +916,8 @@ class S3Request(swob.Request):
src_resp = self.get_response(app, 'HEAD', src_bucket,
swob.str_to_wsgi(src_obj),
headers=headers, query=query)
+ # we can't let this HEAD req spoil our COPY
+ self.headers.pop('x-backend-storage-policy-index')
if src_resp.status_int == 304: # pylint: disable-msg=E1101
raise PreconditionFailed()