in sdk/src/PdsClientImpl.cc [86:118]
bool PdsClientImpl::hasResponseError(const std::shared_ptr<HttpResponse>&response) const
{
if (BASE::hasResponseError(response)) {
return true;
}
//check crc64
if (response->request().hasCheckCrc64() &&
!response->request().hasHeader(Http::RANGE) &&
response->hasHeader("x-oss-hash-crc64ecma")) {
uint64_t clientCrc64 = response->request().Crc64Result();
uint64_t serverCrc64 = std::strtoull(response->Header("x-oss-hash-crc64ecma").c_str(), nullptr, 10);
if (clientCrc64 != serverCrc64) {
response->setStatusCode(ERROR_CRC_INCONSISTENT);
std::stringstream ss;
ss << "Crc64 validation failed. Expected hash:" << serverCrc64
<< " not equal to calculated hash:" << clientCrc64
<< ". Transferd bytes:" << response->request().TransferedBytes()
<< ". RequestId:" << response->Header("x-oss-request-id").c_str();
response->setStatusMsg(ss.str().c_str());
return true;
}
}
//check Calback
if (response->statusCode() == 203 &&
(response->request().hasHeader("x-oss-callback") ||
(response->request().url().query().find("callback=") != std::string::npos))) {
return true;
}
return false;
}