mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Properly fail on partial download
This commit is contained in:
parent
d1334b0c8f
commit
e6405e49c6
1 changed files with 13 additions and 2 deletions
|
@ -159,10 +159,21 @@ void NetRequest::DoTransfer()
|
||||||
// mFailed = true;
|
// mFailed = true;
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
long response_code = 0;
|
long response_code = 0;
|
||||||
curl_easy_getinfo(mCURL, CURLINFO_RESPONSE_CODE, &response_code);
|
curl_easy_getinfo(mCURL, CURLINFO_RESPONSE_CODE, &response_code);
|
||||||
mNetManager->mDebugManager->OutputRawMessage(StrFormat("msgLo Result for '%s': %d\n", mURL.c_str(), response_code));
|
mNetManager->mDebugManager->OutputRawMessage(StrFormat("msgLo Result for '%s': %d\n", mURL.c_str(), response_code));
|
||||||
|
|
||||||
|
if (response_code == 200)
|
||||||
|
{
|
||||||
|
curl_off_t downloadSize = 0;
|
||||||
|
curl_easy_getinfo(mCURL, CURLINFO_SIZE_DOWNLOAD_T, &downloadSize);
|
||||||
|
curl_off_t length = 0;
|
||||||
|
curl_easy_getinfo(mCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &length);
|
||||||
|
if ((downloadSize != 0) && (length != 0) && (downloadSize != length))
|
||||||
|
response_code = -1; // Partial download
|
||||||
|
}
|
||||||
|
|
||||||
if (response_code != 200)
|
if (response_code != 200)
|
||||||
{
|
{
|
||||||
mOutFile.Close();
|
mOutFile.Close();
|
||||||
|
@ -170,7 +181,7 @@ void NetRequest::DoTransfer()
|
||||||
mFailed = true;
|
mFailed = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BfLogDbg("NetManager successfully completed %s\n", mURL.c_str());
|
BfLogDbg("NetManager successfully completed %s\n", mURL.c_str());
|
||||||
|
|
||||||
if (mCancelOnSuccess != NULL)
|
if (mCancelOnSuccess != NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue