Use XML parsing with PUT HTTP 200 responses (#1858)

This works around the missing strcasestr on win32.  References #728.
This commit is contained in:
Andrew Gaul 2022-01-14 16:10:22 +09:00 committed by GitHub
parent 6300859c80
commit 93d1c30d4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1280,9 +1280,9 @@ int S3fsCurl::MapPutErrorResponse(int result)
// </Error>
//
const char* pstrbody = bodydata.str();
if(!pstrbody || NULL != strcasestr(pstrbody, "<Error>")){
S3FS_PRN_ERR("Put request get 200 status response, but it included error body(or NULL). The request failed during copying the object in S3.");
S3FS_PRN_DBG("Put request Response Body : %s", (pstrbody ? pstrbody : "(null)"));
std::string code;
if(!pstrbody || simple_parse_xml(pstrbody, bodydata.size(), "Code", code)){
S3FS_PRN_ERR("Put request get 200 status response, but it included error body(or NULL). The request failed during copying the object in S3. Code: %s", code.c_str());
// TODO: parse more specific error from <Code>
result = -EIO;
}