]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: parse mtime only when header exists and not error
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 24 Mar 2016 22:06:44 +0000 (15:06 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 24 Mar 2016 22:10:26 +0000 (15:10 -0700)
No need to try parsing mtime otherwise.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rest_client.cc

index 718dffb8ed2e27375c6d9b6d19e8f9f567e0cd1d..94821e1c613b3f0b21c7ed2887228443c3c6b055 100644 (file)
@@ -672,12 +672,16 @@ int RGWRESTStreamRWRequest::get_resource(RGWAccessKey& key, map<string, string>&
 int RGWRESTStreamRWRequest::complete(string& etag, real_time *mtime, map<string, string>& attrs)
 {
   set_str_from_headers(out_headers, "ETAG", etag);
-  if (mtime) {
+  if (status > 0 && mtime) {
     string mtime_str;
     set_str_from_headers(out_headers, "RGWX_MTIME", mtime_str);
-    int ret = parse_rgwx_mtime(cct, mtime_str, mtime);
-    if (ret < 0) {
-      return ret;
+    if (!mtime_str.empty()) {
+      int ret = parse_rgwx_mtime(cct, mtime_str, mtime);
+      if (ret < 0) {
+        return ret;
+      }
+    } else {
+      *mtime = real_time();
     }
   }