]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw/lc: report x-amz-expiration only for the current version 69642/head
authorLumir Sliva <61183145+lumir-sliva@users.noreply.github.com>
Mon, 22 Jun 2026 15:20:24 +0000 (17:20 +0200)
committerLumir Sliva <61183145+lumir-sliva@users.noreply.github.com>
Mon, 22 Jun 2026 15:28:45 +0000 (17:28 +0200)
commit960b330d87d9fe979e74ada6d7b1ba1fa403e40c
tree725428811e68e1b4e14341d92010b3c4709cf702
parent2866fcf20c7f6b51c9f1be2f9095ef6041063186
rgw/lc: report x-amz-expiration only for the current version

The x-amz-expiration response header describes the current-version
Expiration lifecycle action for an object. s3_expiration_header() instead
selected between the Expiration and the NoncurrentVersionExpiration rule
based on whether the object key carried an instance id:

  const LCExpiration& rule_expiration =
    (obj_key.instance.empty()) ? expiration : noncur_expiration;

This was wrong in two ways. OLH resolution writes the current version's
instance id into the key before the header is computed, so even a plain
GET/HEAD of the current version (no versionId) was treated as a
non-current request and reported a NoncurrentVersionExpiration rule. And
x-amz-expiration is not meant to surface NoncurrentVersionExpiration at
all. A versioned bucket whose only rule was NoncurrentVersionExpiration
therefore returned a bogus expiry-date and rule-id on the current object,
for both a plain request and a versionId request.

Compute the header from the current-version Expiration rule only, and
return no header when the request targets a specific version. The header
helper now passes the client request key (s->object_key) rather than the
OLH-resolved key, so a plain GET/HEAD of the current version is no longer
misclassified as a versioned request.

Add a unit test covering a noncurrent-only policy (no header for either a
plain or a versioned request) and a combined policy (the current
Expiration rule for the current version, no header for a versionId
request).

Tracker: https://tracker.ceph.com/issues/77564
Reported-by: Saravanan Palanisamy
Signed-off-by: Lumir Sliva <61183145+lumir-sliva@users.noreply.github.com>
src/rgw/rgw_lc.cc
src/rgw/rgw_rest_s3.cc
src/test/rgw/test_rgw_lc.cc