mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-20 08:58:00 +02:00
Merge pull request #1358 from disarray2077/http_error
Improve open error for files from network
This commit is contained in:
commit
88183dbae7
5 changed files with 81 additions and 20 deletions
|
@ -1617,6 +1617,12 @@ BF_EXPORT int HTTP_GetResult(NetResult* netResult, int waitMS)
|
|||
}
|
||||
}
|
||||
|
||||
BF_EXPORT void HTTP_GetLastError(NetResult* netResult, const char** error, int* errorLength)
|
||||
{
|
||||
*error = netResult->mError.GetPtr();
|
||||
*errorLength = netResult->mError.GetLength();
|
||||
}
|
||||
|
||||
BF_EXPORT void HTTP_Delete(NetResult* netResult)
|
||||
{
|
||||
if (!netResult->mDoneEvent->WaitFor(0))
|
||||
|
|
|
@ -165,7 +165,23 @@ void NetRequest::DoTransfer()
|
|||
curl_easy_getinfo(mCURL, CURLINFO_RESPONSE_CODE, &response_code);
|
||||
mNetManager->mDebugManager->OutputRawMessage(StrFormat("msgLo Result for '%s': %d\n", mURL.c_str(), response_code));
|
||||
|
||||
if ((response_code == 0) || (response_code == 200) || (response_code == 404))
|
||||
if (response_code == 0)
|
||||
{
|
||||
mError.Clear();
|
||||
|
||||
int msgs_left = 0;
|
||||
CURLMsg* msg = curl_multi_info_read(mCURLMulti, &msgs_left);
|
||||
|
||||
if (msg != NULL && msg->msg == CURLMSG_DONE)
|
||||
{
|
||||
CURLcode return_code = msg->data.result;
|
||||
mError.Append(curl_easy_strerror(return_code));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ((response_code == 200) || (response_code == 404))
|
||||
break;
|
||||
|
||||
Cleanup();
|
||||
|
@ -410,6 +426,7 @@ NetRequest::~NetRequest()
|
|||
if (mResult != NULL)
|
||||
{
|
||||
mResult->mFailed = mFailed;
|
||||
mResult->mError = mError;
|
||||
mResult->mCurRequest = NULL;
|
||||
if (mResult->mDoneEvent != NULL)
|
||||
{
|
||||
|
|
|
@ -36,12 +36,12 @@ public:
|
|||
#else
|
||||
#endif
|
||||
volatile bool mCancelling;
|
||||
bool mFailed;
|
||||
bool mFailed;
|
||||
String mError;
|
||||
uint32 mLastUpdateTick;
|
||||
bool mShowTracking;
|
||||
NetResult* mResult;
|
||||
NetResult* mCancelOnSuccess;
|
||||
NetResult* mResult;
|
||||
NetResult* mCancelOnSuccess;
|
||||
|
||||
NetRequest()
|
||||
{
|
||||
|
@ -74,8 +74,9 @@ public:
|
|||
String mURL;
|
||||
String mOutPath;
|
||||
bool mFailed;
|
||||
NetRequest* mCurRequest;
|
||||
bool mRemoved;
|
||||
String mError;
|
||||
NetRequest* mCurRequest;
|
||||
bool mRemoved;
|
||||
SyncEvent* mDoneEvent;
|
||||
|
||||
NetResult()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue