]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add headers to guide cache update in 304 response to conditional get
authorIlsoo Byun <ilsoobyun@linecorp.com>
Thu, 28 May 2020 08:01:22 +0000 (17:01 +0900)
committerCasey Bodley <cbodley@redhat.com>
Mon, 8 Jan 2024 19:14:58 +0000 (14:14 -0500)
Fixes: https://tracker.ceph.com/issues/45736
Signed-off-by: Ilsoo Byun <ilsoobyun@linecorp.com>
(cherry picked from commit ca222e47defb06352041da7980fdef508729c4b2)

Conflicts:
src/rgw/driver/rados/rgw_rados.cc
no params.epoch

src/rgw/driver/rados/rgw_rados.cc
src/rgw/rgw_rest_s3.cc

index 10018d4a68a0c30acab2c7dab624d49742897c17..5069233705d2930f9cf686df94e0882a001af0a2 100644 (file)
@@ -6308,6 +6308,10 @@ int RGWRados::Object::Read::prepare(optional_yield y, const DoutPrefixProvider *
     }
   }
 
+  if (params.lastmod) {
+    *params.lastmod = astate->mtime;
+  }
+
   /* Convert all times go GMT to make them compatible */
   if (conds.mod_ptr || conds.unmod_ptr) {
     obj_time_weight src_weight;
@@ -6357,8 +6361,6 @@ int RGWRados::Object::Read::prepare(optional_yield y, const DoutPrefixProvider *
 
   if (params.obj_size)
     *params.obj_size = astate->size;
-  if (params.lastmod)
-    *params.lastmod = astate->mtime;
 
   return 0;
 }
index 0b997f30b10e275c0e94e9de20440ca223e7649e..38e973f7af1c864e942c454f673e2fc0b8a95973 100644 (file)
@@ -563,6 +563,20 @@ done:
   }
 
   if (op_ret == -ERR_NOT_MODIFIED) {
+      dump_last_modified(s, lastmod);
+
+      auto iter = attrs.find(RGW_ATTR_ETAG);
+      if (iter != attrs.end())
+        dump_etag(s, iter->second.to_str());
+
+      iter = attrs.find(RGW_ATTR_CACHE_CONTROL);
+      if (iter != attrs.end())
+        dump_header(s, rgw_to_http_attrs[RGW_ATTR_CACHE_CONTROL], iter->second);
+
+      iter = attrs.find(RGW_ATTR_EXPIRES);
+      if (iter != attrs.end())
+        dump_header(s, rgw_to_http_attrs[RGW_ATTR_EXPIRES], iter->second);
+
       end_header(s, this);
   } else {
       if (!content_type)