diff --git a/src/curl.cpp b/src/curl.cpp index d062af9..a1f46d5 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -2656,6 +2656,26 @@ int S3fsCurl::PutHeadRequest(const char* tpath, headers_t& meta, bool is_copy) S3FS_PRN_INFO3("copying... [path=%s]", tpath); int result = RequestPerform(); + if(0 == result){ + // PUT returns 200 status code with something error, thus + // we need to check body. + // + // example error body: + // + // + // AccessDenied + // Access Denied + // E4CA6F6767D6685C + // BHzLOATeDuvN8Es1wI8IcERq4kl4dc2A9tOB8Yqr39Ys6fl7N4EJ8sjGiVvu6wLP + // + // + const char* pstrbody = bodydata->str(); + if(!pstrbody || NULL != strcasestr(pstrbody, "")){ + S3FS_PRN_ERR("PutHeadRequest get 200 status response, but it included error body(or NULL). The request failed during copying the object in S3."); + S3FS_PRN_DBG("PutHeadRequest Response Body : %s", (pstrbody ? pstrbody : "(null)")); + result = -EIO; + } + } delete bodydata; bodydata = NULL;