From 103f4b8706b9cc852180c990525adc447e905f3e Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 24 Mar 2016 15:06:44 -0700 Subject: [PATCH] rgw: parse mtime only when header exists and not error No need to try parsing mtime otherwise. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_rest_client.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_rest_client.cc b/src/rgw/rgw_rest_client.cc index 718dffb8ed2e2..94821e1c613b3 100644 --- a/src/rgw/rgw_rest_client.cc +++ b/src/rgw/rgw_rest_client.cc @@ -672,12 +672,16 @@ int RGWRESTStreamRWRequest::get_resource(RGWAccessKey& key, map& int RGWRESTStreamRWRequest::complete(string& etag, real_time *mtime, map& 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(); } } -- 2.39.5