diff options
author | Romain de Joux <romain.de-joux@corp.ovh.com> | 2020-04-07 22:03:11 +0200 |
---|---|---|
committer | Romain de Joux <romain.de-joux@corp.ovh.com> | 2020-04-08 11:55:54 +0200 |
commit | 415011e162fad469801e5f5e88a11960f638bdbf (patch) | |
tree | d517e63406087cf2607dffc135fb608cc24ba91e /swift/common/middleware/s3api/s3request.py | |
parent | b4b0ebd4aa0a710af288a69ae787e10420fdeb1a (diff) | |
download | swift-415011e162fad469801e5f5e88a11960f638bdbf.tar.gz |
s3api: Propagate backend PATH_INFO in environ for other middleware
Use swift.backend_path entry in wsgi environment to propagate
backend PATH_INFO.
Needed by ceilometermiddleware to extract account/container info
from PATH_INFO, patch: https://review.opendev.org/#/c/718085/
Change-Id: Ifb3c6c30835d912c5ba4b2e03f2e0b5cb392671a
Diffstat (limited to 'swift/common/middleware/s3api/s3request.py')
-rw-r--r-- | swift/common/middleware/s3api/s3request.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/swift/common/middleware/s3api/s3request.py b/swift/common/middleware/s3api/s3request.py index fa39a68d8..28e734f0b 100644 --- a/swift/common/middleware/s3api/s3request.py +++ b/swift/common/middleware/s3api/s3request.py @@ -1332,6 +1332,12 @@ class S3Request(swob.Request): # reuse account _, self.account, _ = split_path(sw_resp.environ['PATH_INFO'], 2, 3, True) + # Propagate swift.backend_path in environ for middleware + # in pipeline that need Swift PATH_INFO like ceilometermiddleware. + # Store PATH_INFO only the first time to ignore multipart requests. + if 'swift.backend_path' not in self.environ: + self.environ['swift.backend_path'] = \ + sw_resp.environ['PATH_INFO'] resp = S3Response.from_swift_resp(sw_resp) status = resp.status_int # pylint: disable-msg=E1101 |