]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fetch remote obj uses high def clock for if-[un]modified-since
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 15 Mar 2016 01:42:39 +0000 (18:42 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 15 Mar 2016 04:44:41 +0000 (21:44 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_common.cc
src/rgw/rgw_rest_conn.cc

index 833f8c3a2847270d1f7a418c2ec71e7602ea6de9..62f02ed309afb71910c5d77e9119acdda9f3755a 100644 (file)
@@ -471,12 +471,14 @@ int parse_key_value(string& in_str, string& key, string& val)
 int parse_time(const char *time_str, real_time *time)
 {
   struct tm tm;
+  uint32_t ns = 0;
 
-  if (!parse_rfc2616(time_str, &tm))
+  if (!parse_rfc2616(time_str, &tm) && !parse_iso8601(time_str, &tm, &ns)) {
     return -EINVAL;
+  }
 
   time_t sec = timegm(&tm);
-  *time = utime_t(sec, 0).to_real_time();
+  *time = utime_t(sec, ns).to_real_time();
 
   return 0;
 }
index c75f8ff3b7363f0b533dd6549deaa50fd75765b3..2a8995b6993573b44c67c211f32c7c57594e40fa 100644 (file)
@@ -102,7 +102,7 @@ static void set_date_header(const real_time *t, map<string, string>& headers, co
   }
   stringstream s;
   utime_t tm = utime_t(*t);
-  tm.asctime(s);
+  tm.gmtime(s);
   headers[header_name] = s.str();
 }