1
0
forked from 0ad/0ad

Fix UserReporter passing uninitialized data through the JS Interface and displaying it in the UI following 0da7e822ff if the curl connection failed.

Display a generic error message using curl_easy_strerror if the detailed
error description is unavailable.

Differential Revision: https://code.wildfiregames.com/D1625
This was SVN commit r21892.
This commit is contained in:
elexis 2018-09-23 00:20:17 +00:00
parent d19e32b2ea
commit b496168d0a

View File

@ -347,6 +347,7 @@ private:
ConstructRequestData(*report);
m_RequestDataOffset = 0;
m_ResponseData.clear();
m_ErrorBuffer[0] = '\0';
curl_easy_setopt(m_Curl, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)m_RequestData.size());
@ -384,7 +385,12 @@ private:
}
else
{
SetStatus("failed:" + CStr::FromInt(err) + ":" + m_ErrorBuffer);
std::string errorString(m_ErrorBuffer);
if (errorString.empty())
errorString = curl_easy_strerror(err);
SetStatus("failed:" + CStr::FromInt(err) + ":" + errorString);
}
// We got an unhandled return code or a connection failure;