Merge.
commit
d5cc5dcd69
|
|
@ -248,6 +248,7 @@ void HttpCoroHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons
|
|||
|
||||
if (!status)
|
||||
{
|
||||
bool parseSuccess(false);
|
||||
result = LLSD::emptyMap();
|
||||
LLCore::HttpStatus::type_enum_t errType = status.getType();
|
||||
|
||||
|
|
@ -259,7 +260,7 @@ void HttpCoroHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons
|
|||
<< LL_ENDL;
|
||||
if ((errType >= 400) && (errType < 500))
|
||||
{
|
||||
LLSD body = this->parseBody(response);
|
||||
LLSD body = this->parseBody(response, parseSuccess);
|
||||
if (!body.isUndefined())
|
||||
{
|
||||
if (!body.isMap())
|
||||
|
|
@ -362,7 +363,7 @@ public:
|
|||
|
||||
protected:
|
||||
virtual LLSD handleSuccess(LLCore::HttpResponse * response, LLCore::HttpStatus &status);
|
||||
virtual LLSD parseBody(LLCore::HttpResponse *response);
|
||||
virtual LLSD parseBody(LLCore::HttpResponse *response, bool &success);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
@ -377,9 +378,9 @@ LLSD HttpCoroLLSDHandler::handleSuccess(LLCore::HttpResponse * response, LLCore:
|
|||
LLSD result;
|
||||
|
||||
// const bool emit_parse_errors = false;
|
||||
bool success(false);
|
||||
|
||||
|
||||
result = parseBody(response);
|
||||
result = parseBody(response, success);
|
||||
|
||||
#if 0
|
||||
bool parsed = !((response->getBodySize() == 0) ||
|
||||
|
|
@ -403,7 +404,7 @@ LLSD HttpCoroLLSDHandler::handleSuccess(LLCore::HttpResponse * response, LLCore:
|
|||
}
|
||||
#endif
|
||||
|
||||
if (result.isUndefined())
|
||||
if (!success)
|
||||
{
|
||||
#if 1
|
||||
// Only emit a warning if we failed to parse when 'content-type' == 'application/llsd+xml'
|
||||
|
|
@ -437,8 +438,9 @@ LLSD HttpCoroLLSDHandler::handleSuccess(LLCore::HttpResponse * response, LLCore:
|
|||
return result;
|
||||
}
|
||||
|
||||
LLSD HttpCoroLLSDHandler::parseBody(LLCore::HttpResponse *response)
|
||||
LLSD HttpCoroLLSDHandler::parseBody(LLCore::HttpResponse *response, bool &success)
|
||||
{
|
||||
success = true;
|
||||
if (response->getBodySize() == 0)
|
||||
return LLSD();
|
||||
|
||||
|
|
@ -446,6 +448,7 @@ LLSD HttpCoroLLSDHandler::parseBody(LLCore::HttpResponse *response)
|
|||
|
||||
if (!LLCoreHttpUtil::responseToLLSD(response, true, result))
|
||||
{
|
||||
success = false;
|
||||
return LLSD();
|
||||
}
|
||||
|
||||
|
|
@ -467,7 +470,7 @@ public:
|
|||
HttpCoroRawHandler(LLEventStream &reply);
|
||||
|
||||
virtual LLSD handleSuccess(LLCore::HttpResponse * response, LLCore::HttpStatus &status);
|
||||
virtual LLSD parseBody(LLCore::HttpResponse *response);
|
||||
virtual LLSD parseBody(LLCore::HttpResponse *response, bool &success);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
@ -522,8 +525,9 @@ LLSD HttpCoroRawHandler::handleSuccess(LLCore::HttpResponse * response, LLCore::
|
|||
return result;
|
||||
}
|
||||
|
||||
LLSD HttpCoroRawHandler::parseBody(LLCore::HttpResponse *response)
|
||||
LLSD HttpCoroRawHandler::parseBody(LLCore::HttpResponse *response, bool &success)
|
||||
{
|
||||
success = true;
|
||||
return LLSD();
|
||||
}
|
||||
|
||||
|
|
@ -541,7 +545,7 @@ public:
|
|||
HttpCoroJSONHandler(LLEventStream &reply);
|
||||
|
||||
virtual LLSD handleSuccess(LLCore::HttpResponse * response, LLCore::HttpStatus &status);
|
||||
virtual LLSD parseBody(LLCore::HttpResponse *response);
|
||||
virtual LLSD parseBody(LLCore::HttpResponse *response, bool &success);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
@ -579,8 +583,9 @@ LLSD HttpCoroJSONHandler::handleSuccess(LLCore::HttpResponse * response, LLCore:
|
|||
return result;
|
||||
}
|
||||
|
||||
LLSD HttpCoroJSONHandler::parseBody(LLCore::HttpResponse *response)
|
||||
LLSD HttpCoroJSONHandler::parseBody(LLCore::HttpResponse *response, bool &success)
|
||||
{
|
||||
success = true;
|
||||
BufferArray * body(response->getBody());
|
||||
if (!body || !body->size())
|
||||
{
|
||||
|
|
@ -596,6 +601,7 @@ LLSD HttpCoroJSONHandler::parseBody(LLCore::HttpResponse *response)
|
|||
}
|
||||
catch (std::runtime_error e)
|
||||
{
|
||||
success = false;
|
||||
return LLSD();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ public:
|
|||
protected:
|
||||
/// this method may modify the status value
|
||||
virtual LLSD handleSuccess(LLCore::HttpResponse * response, LLCore::HttpStatus &status) = 0;
|
||||
virtual LLSD parseBody(LLCore::HttpResponse *response) = 0;
|
||||
virtual LLSD parseBody(LLCore::HttpResponse *response, bool &success) = 0;
|
||||
|
||||
private:
|
||||
void buildStatusEntry(LLCore::HttpResponse *response, LLCore::HttpStatus status, LLSD &result);
|
||||
|
|
|
|||
|
|
@ -192,11 +192,14 @@ void LLTranslationAPIHandler::translateMessageCoro(LanguagePair_t fromTo, std::s
|
|||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
std::string translation, detected_lang, err_msg;
|
||||
std::string translation, err_msg;
|
||||
std::string detected_lang(fromTo.second);
|
||||
|
||||
int parseResult = status.getType();
|
||||
if (this->parseResponse(parseResult, result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asString(),
|
||||
translation, detected_lang, err_msg))
|
||||
const LLSD::Binary &rawBody = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary();
|
||||
std::string body(rawBody.begin(), rawBody.end());
|
||||
|
||||
if (this->parseResponse(parseResult, body, translation, detected_lang, err_msg))
|
||||
{
|
||||
// Fix up the response
|
||||
LLStringUtil::replaceString(translation, "<", "<");
|
||||
|
|
|
|||
|
|
@ -4323,7 +4323,7 @@ void translateSuccess(LLChat chat, LLSD toastArgs, std::string originalMsg, std:
|
|||
{
|
||||
// filter out non-interesting responses
|
||||
if (!translation.empty()
|
||||
&& (expectLang != detected_language)
|
||||
&& ((detected_language.empty()) || (expectLang != detected_language))
|
||||
&& (LLStringUtil::compareInsensitive(translation, originalMsg) != 0))
|
||||
{
|
||||
chat.mText += " (" + translation + ")";
|
||||
|
|
@ -7093,6 +7093,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
|
|||
}
|
||||
}
|
||||
final_args["SLURLMESSAGE"] = message;
|
||||
payload["dest_id"] = dest_id;
|
||||
|
||||
args["NAME"] = dest_slurl_name;
|
||||
if (!reason.empty())
|
||||
|
|
|
|||
Loading…
Reference in New Issue