Updated feature manager downloader to coroutine.
Added "raw" coroutine handler (returns raw result as LLSD::Binary) and split out the guts of the get, put, etc methods. Moved getStatusFromLLSD from HttpCoroHandler into HttpCorutineAdaptermaster
parent
6cba35d3c0
commit
3e004ce66e
|
|
@ -28,7 +28,8 @@
|
|||
#include "linden_common.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include "llcorehttputil.h"
|
||||
#include "llhttpconstants.h"
|
||||
#include "llsdserialize.h"
|
||||
|
|
@ -38,9 +39,25 @@ using namespace LLCore;
|
|||
|
||||
namespace LLCoreHttpUtil
|
||||
{
|
||||
//=========================================================================
|
||||
/// The HttpRequestPumper is a utility class. When constructed it will poll the
|
||||
/// supplied HttpRequest once per frame until it is destroyed.
|
||||
///
|
||||
class HttpRequestPumper
|
||||
{
|
||||
public:
|
||||
HttpRequestPumper(const LLCore::HttpRequest::ptr_t &request);
|
||||
~HttpRequestPumper();
|
||||
|
||||
private:
|
||||
bool pollRequest(const LLSD&);
|
||||
|
||||
LLTempBoundListener mBoundListener;
|
||||
LLCore::HttpRequest::ptr_t mHttpRequest;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// *TODO: Currently converts only from XML content. A mode
|
||||
// to convert using fromBinary() might be useful as well. Mesh
|
||||
// headers could use it.
|
||||
|
|
@ -91,7 +108,6 @@ HttpHandle requestPostWithLLSD(HttpRequest * request,
|
|||
}
|
||||
|
||||
|
||||
|
||||
HttpHandle requestPutWithLLSD(HttpRequest * request,
|
||||
HttpRequest::policy_t policy_id,
|
||||
HttpRequest::priority_t priority,
|
||||
|
|
@ -191,6 +207,7 @@ std::string responseToString(LLCore::HttpResponse * response)
|
|||
}
|
||||
|
||||
//========================================================================
|
||||
|
||||
HttpCoroHandler::HttpCoroHandler(LLEventStream &reply) :
|
||||
mReplyPump(reply)
|
||||
{
|
||||
|
|
@ -221,42 +238,7 @@ void HttpCoroHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons
|
|||
}
|
||||
else
|
||||
{
|
||||
const bool emit_parse_errors = false;
|
||||
|
||||
bool parsed = !((response->getBodySize() == 0) ||
|
||||
!LLCoreHttpUtil::responseToLLSD(response, emit_parse_errors, result));
|
||||
|
||||
if (!parsed)
|
||||
{
|
||||
// Only emit a warning if we failed to parse when 'content-type' == 'application/llsd+xml'
|
||||
LLCore::HttpHeaders::ptr_t headers(response->getHeaders());
|
||||
const std::string *contentType = (headers) ? headers->find(HTTP_IN_HEADER_CONTENT_TYPE) : NULL;
|
||||
|
||||
if (contentType && (HTTP_CONTENT_LLSD_XML == *contentType))
|
||||
{
|
||||
std::string thebody = LLCoreHttpUtil::responseToString(response);
|
||||
LL_WARNS() << "Failed to deserialize . " << response->getRequestURL() << " [status:" << response->getStatus().toString() << "] "
|
||||
<< " body: " << thebody << LL_ENDL;
|
||||
|
||||
// Replace the status with a new one indicating the failure.
|
||||
status = LLCore::HttpStatus(499, "Failed to deserialize LLSD.");
|
||||
}
|
||||
}
|
||||
|
||||
if (result.isUndefined())
|
||||
{ // If we've gotten to this point and the result LLSD is still undefined
|
||||
// either there was an issue deserializing the body or the response was
|
||||
// blank. Create an empty map to hold the result either way.
|
||||
result = LLSD::emptyMap();
|
||||
}
|
||||
else if (!result.isMap())
|
||||
{ // The results are not themselves a map. Move them down so that
|
||||
// this method can return a map to the caller.
|
||||
// *TODO: Should it always do this?
|
||||
LLSD newResult = LLSD::emptyMap();
|
||||
newResult[HttpCoroutineAdapter::HTTP_RESULTS_CONTENT] = result;
|
||||
result = newResult;
|
||||
}
|
||||
result = this->handleSuccess(response, status);
|
||||
}
|
||||
|
||||
buildStatusEntry(response, status, result);
|
||||
|
|
@ -301,12 +283,126 @@ void HttpCoroHandler::writeStatusCodes(LLCore::HttpStatus status, const std::str
|
|||
|
||||
}
|
||||
|
||||
LLCore::HttpStatus HttpCoroHandler::getStatusFromLLSD(const LLSD &httpResults)
|
||||
//=========================================================================
|
||||
/// The HttpCoroLLSDHandler is a specialization of the LLCore::HttpHandler for
|
||||
/// interacting with coroutines. When the request is completed the response
|
||||
/// will be posted onto the supplied Event Pump.
|
||||
///
|
||||
/// The LLSD posted back to the coroutine will have the following additions:
|
||||
/// llsd["http_result"] -+- ["message"] - An error message returned from the HTTP status
|
||||
/// +- ["status"] - The status code associated with the HTTP call
|
||||
/// +- ["success"] - Success of failure of the HTTP call and LLSD parsing.
|
||||
/// +- ["type"] - The LLCore::HttpStatus type associted with the HTTP call
|
||||
/// +- ["url"] - The URL used to make the call.
|
||||
/// +- ["headers"] - A map of name name value pairs with the HTTP headers.
|
||||
///
|
||||
class HttpCoroLLSDHandler : public HttpCoroHandler
|
||||
{
|
||||
LLCore::HttpStatus::type_enum_t type = static_cast<LLCore::HttpStatus::type_enum_t>(httpResults[HttpCoroutineAdapter::HTTP_RESULTS_TYPE].asInteger());
|
||||
short code = static_cast<short>(httpResults[HttpCoroutineAdapter::HTTP_RESULTS_STATUS].asInteger());
|
||||
public:
|
||||
HttpCoroLLSDHandler(LLEventStream &reply);
|
||||
|
||||
return LLCore::HttpStatus(type, code);
|
||||
protected:
|
||||
virtual LLSD handleSuccess(LLCore::HttpResponse * response, LLCore::HttpStatus &status);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
HttpCoroLLSDHandler::HttpCoroLLSDHandler(LLEventStream &reply):
|
||||
HttpCoroHandler(reply)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LLSD HttpCoroLLSDHandler::handleSuccess(LLCore::HttpResponse * response, LLCore::HttpStatus &status)
|
||||
{
|
||||
LLSD result;
|
||||
|
||||
const bool emit_parse_errors = false;
|
||||
|
||||
bool parsed = !((response->getBodySize() == 0) ||
|
||||
!LLCoreHttpUtil::responseToLLSD(response, emit_parse_errors, result));
|
||||
|
||||
if (!parsed)
|
||||
{
|
||||
// Only emit a warning if we failed to parse when 'content-type' == 'application/llsd+xml'
|
||||
LLCore::HttpHeaders::ptr_t headers(response->getHeaders());
|
||||
const std::string *contentType = (headers) ? headers->find(HTTP_IN_HEADER_CONTENT_TYPE) : NULL;
|
||||
|
||||
if (contentType && (HTTP_CONTENT_LLSD_XML == *contentType))
|
||||
{
|
||||
std::string thebody = LLCoreHttpUtil::responseToString(response);
|
||||
LL_WARNS() << "Failed to deserialize . " << response->getRequestURL() << " [status:" << response->getStatus().toString() << "] "
|
||||
<< " body: " << thebody << LL_ENDL;
|
||||
|
||||
// Replace the status with a new one indicating the failure.
|
||||
status = LLCore::HttpStatus(499, "Failed to deserialize LLSD.");
|
||||
}
|
||||
}
|
||||
|
||||
if (result.isUndefined())
|
||||
{ // If we've gotten to this point and the result LLSD is still undefined
|
||||
// either there was an issue deserializing the body or the response was
|
||||
// blank. Create an empty map to hold the result either way.
|
||||
result = LLSD::emptyMap();
|
||||
}
|
||||
else if (!result.isMap())
|
||||
{ // The results are not themselves a map. Move them down so that
|
||||
// this method can return a map to the caller.
|
||||
// *TODO: Should it always do this?
|
||||
LLSD newResult = LLSD::emptyMap();
|
||||
newResult[HttpCoroutineAdapter::HTTP_RESULTS_CONTENT] = result;
|
||||
result = newResult;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
/// The HttpCoroRawHandler is a specialization of the LLCore::HttpHandler for
|
||||
/// interacting with coroutines.
|
||||
///
|
||||
/// In addition to the normal "http_results" the returned LLSD will contain
|
||||
/// an entry keyed with "raw" containing the unprocessed results of the HTTP
|
||||
/// call.
|
||||
///
|
||||
class HttpCoroRawHandler : public HttpCoroHandler
|
||||
{
|
||||
public:
|
||||
HttpCoroRawHandler(LLEventStream &reply);
|
||||
|
||||
virtual LLSD handleSuccess(LLCore::HttpResponse * response, LLCore::HttpStatus &status);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
HttpCoroRawHandler::HttpCoroRawHandler(LLEventStream &reply):
|
||||
HttpCoroHandler(reply)
|
||||
{
|
||||
}
|
||||
|
||||
LLSD HttpCoroRawHandler::handleSuccess(LLCore::HttpResponse * response, LLCore::HttpStatus &status)
|
||||
{
|
||||
LLSD result = LLSD::emptyMap();
|
||||
|
||||
BufferArray * body(response->getBody());
|
||||
if (!body || !body->size())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t size = body->size();
|
||||
|
||||
LLCore::BufferArrayStream bas(body);
|
||||
|
||||
// We create a new LLSD::Binary object and assign it to the result map.
|
||||
// The LLSD has created it's own copy so we retrieve it asBinary and const cast
|
||||
// the reference so that we can modify it.
|
||||
result[HttpCoroutineAdapter::HTTP_RESULTS_RAW] = LLSD::Binary();
|
||||
LLSD::Binary &data = const_cast<LLSD::Binary &>( result[HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary() );
|
||||
|
||||
data.reserve(size);
|
||||
bas >> std::noskipws;
|
||||
data.assign(std::istream_iterator<U8>(bas), std::istream_iterator<U8>());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
|
|
@ -343,7 +439,7 @@ const std::string HttpCoroutineAdapter::HTTP_RESULTS_MESSAGE("message");
|
|||
const std::string HttpCoroutineAdapter::HTTP_RESULTS_URL("url");
|
||||
const std::string HttpCoroutineAdapter::HTTP_RESULTS_HEADERS("headers");
|
||||
const std::string HttpCoroutineAdapter::HTTP_RESULTS_CONTENT("content");
|
||||
|
||||
const std::string HttpCoroutineAdapter::HTTP_RESULTS_RAW("raw");
|
||||
|
||||
HttpCoroutineAdapter::HttpCoroutineAdapter(const std::string &name,
|
||||
LLCore::HttpRequest::policy_t policyId, LLCore::HttpRequest::priority_t priority) :
|
||||
|
|
@ -366,27 +462,33 @@ LLSD HttpCoroutineAdapter::postAndYield(LLCoros::self & self, LLCore::HttpReques
|
|||
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
|
||||
{
|
||||
LLEventStream replyPump(mAdapterName, true);
|
||||
LLCoreHttpUtil::HttpCoroHandler::ptr_t httpHandler =
|
||||
LLCoreHttpUtil::HttpCoroHandler::ptr_t(new LLCoreHttpUtil::HttpCoroHandler(replyPump));
|
||||
HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump));
|
||||
|
||||
return postAndYield_(self, request, url, body, options, headers, httpHandler);
|
||||
}
|
||||
|
||||
LLSD HttpCoroutineAdapter::postAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url, const LLSD & body,
|
||||
LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers,
|
||||
HttpCoroHandler::ptr_t &handler)
|
||||
{
|
||||
//LL_INFOS() << "Requesting transaction " << transactionId << LL_ENDL;
|
||||
LLCoreHttpUtil::HttpRequestPumper pumper(request);
|
||||
HttpRequestPumper pumper(request);
|
||||
// The HTTPCoroHandler does not self delete, so retrieval of a the contained
|
||||
// pointer from the smart pointer is safe in this case.
|
||||
LLCore::HttpHandle hhandle = requestPostWithLLSD(request,
|
||||
mPolicyId, mPriority, url, body, options, headers,
|
||||
httpHandler.get());
|
||||
handler.get());
|
||||
|
||||
if (hhandle == LLCORE_HTTP_HANDLE_INVALID)
|
||||
{
|
||||
return HttpCoroutineAdapter::buildImmediateErrorResult(request, url);
|
||||
}
|
||||
|
||||
saveState(hhandle, request, httpHandler);
|
||||
LLSD results = waitForEventOn(self, replyPump);
|
||||
saveState(hhandle, request, handler);
|
||||
LLSD results = waitForEventOn(self, handler->getReplyPump());
|
||||
cleanState();
|
||||
|
||||
//LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL;
|
||||
return results;
|
||||
}
|
||||
|
||||
|
|
@ -395,23 +497,30 @@ LLSD HttpCoroutineAdapter::postAndYield(LLCoros::self & self, LLCore::HttpReques
|
|||
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
|
||||
{
|
||||
LLEventStream replyPump(mAdapterName, true);
|
||||
LLCoreHttpUtil::HttpCoroHandler::ptr_t httpHandler =
|
||||
LLCoreHttpUtil::HttpCoroHandler::ptr_t(new LLCoreHttpUtil::HttpCoroHandler(replyPump));
|
||||
HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump));
|
||||
|
||||
return postAndYield_(self, request, url, rawbody, options, headers, httpHandler);
|
||||
}
|
||||
|
||||
LLSD HttpCoroutineAdapter::postAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url, LLCore::BufferArray::ptr_t &rawbody,
|
||||
LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers,
|
||||
HttpCoroHandler::ptr_t &handler)
|
||||
{
|
||||
//LL_INFOS() << "Requesting transaction " << transactionId << LL_ENDL;
|
||||
LLCoreHttpUtil::HttpRequestPumper pumper(request);
|
||||
HttpRequestPumper pumper(request);
|
||||
// The HTTPCoroHandler does not self delete, so retrieval of a the contained
|
||||
// pointer from the smart pointer is safe in this case.
|
||||
LLCore::HttpHandle hhandle = request->requestPost(mPolicyId, mPriority, url, rawbody.get(),
|
||||
options.get(), headers.get(), httpHandler.get());
|
||||
LLCore::HttpHandle hhandle = request->requestPost(mPolicyId, mPriority, url, rawbody.get(),
|
||||
options.get(), headers.get(), handler.get());
|
||||
|
||||
if (hhandle == LLCORE_HTTP_HANDLE_INVALID)
|
||||
{
|
||||
return HttpCoroutineAdapter::buildImmediateErrorResult(request, url);
|
||||
}
|
||||
|
||||
saveState(hhandle, request, httpHandler);
|
||||
LLSD results = waitForEventOn(self, replyPump);
|
||||
saveState(hhandle, request, handler);
|
||||
LLSD results = waitForEventOn(self, handler->getReplyPump());
|
||||
cleanState();
|
||||
|
||||
//LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL;
|
||||
|
|
@ -422,25 +531,32 @@ LLSD HttpCoroutineAdapter::putAndYield(LLCoros::self & self, LLCore::HttpRequest
|
|||
const std::string & url, const LLSD & body,
|
||||
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
|
||||
{
|
||||
LLEventStream replyPump(mAdapterName, true);
|
||||
LLCoreHttpUtil::HttpCoroHandler::ptr_t httpHandler =
|
||||
LLCoreHttpUtil::HttpCoroHandler::ptr_t(new LLCoreHttpUtil::HttpCoroHandler(replyPump));
|
||||
LLEventStream replyPump(mAdapterName + "Reply", true);
|
||||
HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump));
|
||||
|
||||
return putAndYield_(self, request, url, body, options, headers, httpHandler);
|
||||
}
|
||||
|
||||
LLSD HttpCoroutineAdapter::putAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url, const LLSD & body,
|
||||
LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers,
|
||||
HttpCoroHandler::ptr_t &handler)
|
||||
{
|
||||
//LL_INFOS() << "Requesting transaction " << transactionId << LL_ENDL;
|
||||
LLCoreHttpUtil::HttpRequestPumper pumper(request);
|
||||
HttpRequestPumper pumper(request);
|
||||
// The HTTPCoroHandler does not self delete, so retrieval of a the contained
|
||||
// pointer from the smart pointer is safe in this case.
|
||||
LLCore::HttpHandle hhandle = requestPutWithLLSD(request,
|
||||
mPolicyId, mPriority, url, body, options, headers,
|
||||
httpHandler.get());
|
||||
handler.get());
|
||||
|
||||
if (hhandle == LLCORE_HTTP_HANDLE_INVALID)
|
||||
{
|
||||
return HttpCoroutineAdapter::buildImmediateErrorResult(request, url);
|
||||
}
|
||||
|
||||
saveState(hhandle, request, httpHandler);
|
||||
LLSD results = waitForEventOn(self, replyPump);
|
||||
saveState(hhandle, request, handler);
|
||||
LLSD results = waitForEventOn(self, handler->getReplyPump());
|
||||
cleanState();
|
||||
//LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL;
|
||||
return results;
|
||||
|
|
@ -451,50 +567,74 @@ LLSD HttpCoroutineAdapter::getAndYield(LLCoros::self & self, LLCore::HttpRequest
|
|||
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
|
||||
{
|
||||
LLEventStream replyPump(mAdapterName + "Reply", true);
|
||||
LLCoreHttpUtil::HttpCoroHandler::ptr_t httpHandler =
|
||||
LLCoreHttpUtil::HttpCoroHandler::ptr_t(new LLCoreHttpUtil::HttpCoroHandler(replyPump));
|
||||
HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump));
|
||||
|
||||
return getAndYield_(self, request, url, options, headers, httpHandler);
|
||||
}
|
||||
|
||||
LLSD HttpCoroutineAdapter::getRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request,
|
||||
const std::string & url,
|
||||
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
|
||||
{
|
||||
LLEventStream replyPump(mAdapterName + "Reply", true);
|
||||
HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroRawHandler(replyPump));
|
||||
|
||||
return getAndYield_(self, request, url, options, headers, httpHandler);
|
||||
}
|
||||
|
||||
LLSD HttpCoroutineAdapter::getAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url,
|
||||
LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers,
|
||||
HttpCoroHandler::ptr_t &handler)
|
||||
{
|
||||
//LL_INFOS() << "Requesting transaction " << transactionId << LL_ENDL;
|
||||
LLCoreHttpUtil::HttpRequestPumper pumper(request);
|
||||
HttpRequestPumper pumper(request);
|
||||
// The HTTPCoroHandler does not self delete, so retrieval of a the contained
|
||||
// pointer from the smart pointer is safe in this case.
|
||||
LLCore::HttpHandle hhandle = request->requestGet(mPolicyId, mPriority,
|
||||
url, options.get(), headers.get(), httpHandler.get());
|
||||
LLCore::HttpHandle hhandle = request->requestGet(mPolicyId, mPriority,
|
||||
url, options.get(), headers.get(), handler.get());
|
||||
|
||||
if (hhandle == LLCORE_HTTP_HANDLE_INVALID)
|
||||
{
|
||||
return HttpCoroutineAdapter::buildImmediateErrorResult(request, url);
|
||||
}
|
||||
|
||||
saveState(hhandle, request, httpHandler);
|
||||
LLSD results = waitForEventOn(self, replyPump);
|
||||
saveState(hhandle, request, handler);
|
||||
LLSD results = waitForEventOn(self, handler->getReplyPump());
|
||||
cleanState();
|
||||
//LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL;
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
LLSD HttpCoroutineAdapter::deleteAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request,
|
||||
const std::string & url,
|
||||
LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers)
|
||||
{
|
||||
LLEventStream replyPump(mAdapterName + "Reply", true);
|
||||
LLCoreHttpUtil::HttpCoroHandler::ptr_t httpHandler =
|
||||
LLCoreHttpUtil::HttpCoroHandler::ptr_t(new LLCoreHttpUtil::HttpCoroHandler(replyPump));
|
||||
HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump));
|
||||
|
||||
return deleteAndYield_(self, request, url, options, headers, httpHandler);
|
||||
}
|
||||
|
||||
LLSD HttpCoroutineAdapter::deleteAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url, LLCore::HttpOptions::ptr_t &options,
|
||||
LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler)
|
||||
{
|
||||
//LL_INFOS() << "Requesting transaction " << transactionId << LL_ENDL;
|
||||
LLCoreHttpUtil::HttpRequestPumper pumper(request);
|
||||
HttpRequestPumper pumper(request);
|
||||
// The HTTPCoroHandler does not self delete, so retrieval of a the contained
|
||||
// pointer from the smart pointer is safe in this case.
|
||||
LLCore::HttpHandle hhandle = request->requestDelete(mPolicyId, mPriority,
|
||||
url, options.get(), headers.get(), httpHandler.get());
|
||||
url, options.get(), headers.get(), handler.get());
|
||||
|
||||
if (hhandle == LLCORE_HTTP_HANDLE_INVALID)
|
||||
{
|
||||
return HttpCoroutineAdapter::buildImmediateErrorResult(request, url);
|
||||
}
|
||||
|
||||
saveState(hhandle, request, httpHandler);
|
||||
LLSD results = waitForEventOn(self, replyPump);
|
||||
saveState(hhandle, request, handler);
|
||||
LLSD results = waitForEventOn(self, handler->getReplyPump());
|
||||
cleanState();
|
||||
//LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL;
|
||||
return results;
|
||||
|
|
@ -547,5 +687,14 @@ LLSD HttpCoroutineAdapter::buildImmediateErrorResult(const LLCore::HttpRequest::
|
|||
return errorres;
|
||||
}
|
||||
|
||||
LLCore::HttpStatus HttpCoroutineAdapter::getStatusFromLLSD(const LLSD &httpResults)
|
||||
{
|
||||
LLCore::HttpStatus::type_enum_t type = static_cast<LLCore::HttpStatus::type_enum_t>(httpResults[HttpCoroutineAdapter::HTTP_RESULTS_TYPE].asInteger());
|
||||
short code = static_cast<short>(httpResults[HttpCoroutineAdapter::HTTP_RESULTS_STATUS].asInteger());
|
||||
|
||||
return LLCore::HttpStatus(type, code);
|
||||
}
|
||||
|
||||
|
||||
} // end namespace LLCoreHttpUtil
|
||||
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ inline LLCore::HttpHandle requestPatchWithLLSD(LLCore::HttpRequest::ptr_t & requ
|
|||
url, body, NULL, NULL, handler);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
/// The HttpCoroHandler is a specialization of the LLCore::HttpHandler for
|
||||
/// interacting with coroutines. When the request is completed the response
|
||||
/// will be posted onto the supplied Event Pump.
|
||||
|
|
@ -256,10 +257,18 @@ public:
|
|||
|
||||
HttpCoroHandler(LLEventStream &reply);
|
||||
|
||||
static void writeStatusCodes(LLCore::HttpStatus status, const std::string &url, LLSD &result);
|
||||
|
||||
virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
|
||||
|
||||
static void writeStatusCodes(LLCore::HttpStatus status, const std::string &url, LLSD &result);
|
||||
static LLCore::HttpStatus getStatusFromLLSD(const LLSD &httpResults);
|
||||
inline LLEventStream &getReplyPump()
|
||||
{
|
||||
return mReplyPump;
|
||||
}
|
||||
|
||||
protected:
|
||||
/// this method may modify the status value
|
||||
virtual LLSD handleSuccess(LLCore::HttpResponse * response, LLCore::HttpStatus &status) = 0;
|
||||
|
||||
private:
|
||||
void buildStatusEntry(LLCore::HttpResponse *response, LLCore::HttpStatus status, LLSD &result);
|
||||
|
|
@ -267,22 +276,7 @@ private:
|
|||
LLEventStream &mReplyPump;
|
||||
};
|
||||
|
||||
/// The HttpRequestPumper is a utility class. When constructed it will poll the
|
||||
/// supplied HttpRequest once per frame until it is destroyed.
|
||||
///
|
||||
class HttpRequestPumper
|
||||
{
|
||||
public:
|
||||
HttpRequestPumper(const LLCore::HttpRequest::ptr_t &request);
|
||||
~HttpRequestPumper();
|
||||
|
||||
private:
|
||||
bool pollRequest(const LLSD&);
|
||||
|
||||
LLTempBoundListener mBoundListener;
|
||||
LLCore::HttpRequest::ptr_t mHttpRequest;
|
||||
};
|
||||
|
||||
//=========================================================================
|
||||
/// An adapter to handle some of the boilerplate code surrounding HTTP and coroutine
|
||||
/// interaction.
|
||||
///
|
||||
|
|
@ -302,6 +296,7 @@ public:
|
|||
static const std::string HTTP_RESULTS_URL;
|
||||
static const std::string HTTP_RESULTS_HEADERS;
|
||||
static const std::string HTTP_RESULTS_CONTENT;
|
||||
static const std::string HTTP_RESULTS_RAW;
|
||||
|
||||
typedef boost::shared_ptr<HttpCoroutineAdapter> ptr_t;
|
||||
typedef boost::weak_ptr<HttpCoroutineAdapter> wptr_t;
|
||||
|
|
@ -366,6 +361,19 @@ public:
|
|||
headers);
|
||||
}
|
||||
|
||||
LLSD getRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request,
|
||||
const std::string & url,
|
||||
LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions(), false),
|
||||
LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false));
|
||||
LLSD getRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url, LLCore::HttpHeaders::ptr_t &headers)
|
||||
{
|
||||
return getRawAndYield(self, request, url,
|
||||
LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions(), false),
|
||||
headers);
|
||||
}
|
||||
|
||||
|
||||
/// Execute a DELETE transaction on the supplied URL and yield execution of
|
||||
/// the coroutine until a result is available.
|
||||
///
|
||||
|
|
@ -379,6 +387,8 @@ public:
|
|||
///
|
||||
void cancelYieldingOperation();
|
||||
|
||||
static LLCore::HttpStatus getStatusFromLLSD(const LLSD &httpResults);
|
||||
|
||||
private:
|
||||
static LLSD buildImmediateErrorResult(const LLCore::HttpRequest::ptr_t &request, const std::string &url);
|
||||
|
||||
|
|
@ -386,6 +396,28 @@ private:
|
|||
HttpCoroHandler::ptr_t &handler);
|
||||
void cleanState();
|
||||
|
||||
LLSD postAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url, const LLSD & body,
|
||||
LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers,
|
||||
HttpCoroHandler::ptr_t &handler);
|
||||
|
||||
LLSD postAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url, LLCore::BufferArray::ptr_t &rawbody,
|
||||
LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers,
|
||||
HttpCoroHandler::ptr_t &handler);
|
||||
|
||||
LLSD putAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url, const LLSD & body,
|
||||
LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers,
|
||||
HttpCoroHandler::ptr_t &handler);
|
||||
|
||||
LLSD getAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url, LLCore::HttpOptions::ptr_t &options,
|
||||
LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler);
|
||||
|
||||
LLSD deleteAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request,
|
||||
const std::string & url, LLCore::HttpOptions::ptr_t &options,
|
||||
LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler);
|
||||
|
||||
std::string mAdapterName;
|
||||
LLCore::HttpRequest::priority_t mPriority;
|
||||
|
|
@ -396,8 +428,6 @@ private:
|
|||
HttpCoroHandler::wptr_t mWeakHandler;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
LLCore::HttpStatus getStatusFromLLSD(const LLSD &httpResults);
|
||||
|
||||
} // end namespace LLCoreHttpUtil
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(LLCoros::self& self,
|
|||
}
|
||||
|
||||
LLSD httpResults = result["http_result"];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
@ -202,7 +202,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(LLCoros::self& sel
|
|||
}
|
||||
|
||||
LLSD httpResults = result["http_result"];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
if (!status)
|
||||
{
|
||||
LL_WARNS("AvatarRenderInfoAccountant") << "HTTP status, " << status.toTerseString() << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ void LLEstateInfoModel::commitEstateInfoCapsCoro(LLCoros::self& self, std::strin
|
|||
LLSD result = httpAdapter->postAndYield(self, httpRequest, url, body);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (status)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ namespace Details
|
|||
// << LLSDXMLStreamer(result) << LL_ENDL;
|
||||
|
||||
LLSD httpResults = result["http_result"];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut
|
|||
LLSD result = httpAdapter->putAndYield(self, httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
if (!status)
|
||||
{
|
||||
if (status == LLCore::HttpStatus(HTTP_FOUND))
|
||||
|
|
@ -180,7 +180,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut
|
|||
bool LLFacebookConnect::testShareStatus(LLSD &result)
|
||||
{
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (status)
|
||||
return true;
|
||||
|
|
@ -314,7 +314,7 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self)
|
|||
LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection"));
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
if (!status && (status != LLCore::HttpStatus(HTTP_FOUND)))
|
||||
{
|
||||
LL_WARNS("FacebookConnect") << "Failed to disconnect:" << status.toTerseString() << LL_ENDL;
|
||||
|
|
@ -347,7 +347,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true));
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
@ -394,7 +394,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self)
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (status == LLCore::HttpStatus(HTTP_FOUND))
|
||||
{
|
||||
|
|
@ -434,7 +434,7 @@ void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self)
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true));
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (status == LLCore::HttpStatus(HTTP_FOUND))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
#include "llviewershadermgr.h"
|
||||
#include "llstring.h"
|
||||
#include "stringize.h"
|
||||
#include "llcorehttputil.h"
|
||||
|
||||
#if LL_WINDOWS
|
||||
#include "lldxhardware.h"
|
||||
|
|
@ -492,95 +493,68 @@ bool LLFeatureManager::loadGPUClass()
|
|||
return true; // indicates that a gpu value was established
|
||||
}
|
||||
|
||||
|
||||
// responder saves table into file
|
||||
class LLHTTPFeatureTableResponder : public LLHTTPClient::Responder
|
||||
void LLFeatureManager::fetchFeatureTableCoro(LLCoros::self& self, std::string tableName)
|
||||
{
|
||||
LOG_CLASS(LLHTTPFeatureTableResponder);
|
||||
public:
|
||||
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
|
||||
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
|
||||
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FeatureManagerHTTPTable", httpPolicy));
|
||||
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
|
||||
|
||||
LLHTTPFeatureTableResponder(std::string filename) :
|
||||
mFilename(filename)
|
||||
{
|
||||
}
|
||||
const std::string base = gSavedSettings.getString("FeatureManagerHTTPTable");
|
||||
|
||||
|
||||
virtual void completedRaw(const LLChannelDescriptors& channels,
|
||||
const LLIOPipe::buffer_ptr_t& buffer)
|
||||
{
|
||||
if (isGoodStatus())
|
||||
{
|
||||
// write to file
|
||||
|
||||
LL_INFOS() << "writing feature table to " << mFilename << LL_ENDL;
|
||||
|
||||
S32 file_size = buffer->countAfter(channels.in(), NULL);
|
||||
if (file_size > 0)
|
||||
{
|
||||
// read from buffer
|
||||
U8* copy_buffer = new U8[file_size];
|
||||
buffer->readAfter(channels.in(), NULL, copy_buffer, file_size);
|
||||
|
||||
// write to file
|
||||
LLAPRFile out(mFilename, LL_APR_WB);
|
||||
out.write(copy_buffer, file_size);
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char body[1025];
|
||||
body[1024] = '\0';
|
||||
LLBufferStream istr(channels, buffer.get());
|
||||
istr.get(body,1024);
|
||||
if (strlen(body) > 0)
|
||||
{
|
||||
mContent["body"] = body;
|
||||
}
|
||||
LL_WARNS() << dumpResponse() << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::string mFilename;
|
||||
};
|
||||
|
||||
void fetch_feature_table(std::string table)
|
||||
{
|
||||
const std::string base = gSavedSettings.getString("FeatureManagerHTTPTable");
|
||||
|
||||
#if LL_WINDOWS
|
||||
std::string os_string = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
|
||||
std::string filename;
|
||||
if (os_string.find("Microsoft Windows XP") == 0)
|
||||
{
|
||||
filename = llformat(table.c_str(), "_xp", LLVersionInfo::getVersion().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = llformat(table.c_str(), "", LLVersionInfo::getVersion().c_str());
|
||||
}
|
||||
std::string os_string = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
|
||||
std::string filename;
|
||||
|
||||
if (os_string.find("Microsoft Windows XP") == 0)
|
||||
{
|
||||
filename = llformat(tableName.c_str(), "_xp", LLVersionInfo::getVersion().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = llformat(tableName.c_str(), "", LLVersionInfo::getVersion().c_str());
|
||||
}
|
||||
#else
|
||||
const std::string filename = llformat(table.c_str(), LLVersionInfo::getVersion().c_str());
|
||||
const std::string filename = llformat(table.c_str(), LLVersionInfo::getVersion().c_str());
|
||||
#endif
|
||||
|
||||
const std::string url = base + "/" + filename;
|
||||
std::string url = base + "/" + filename;
|
||||
const std::string path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename);
|
||||
|
||||
const std::string path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename);
|
||||
|
||||
LL_INFOS() << "LLFeatureManager fetching " << url << " into " << path << LL_ENDL;
|
||||
|
||||
LLHTTPClient::get(url, new LLHTTPFeatureTableResponder(path));
|
||||
LL_INFOS() << "LLFeatureManager fetching " << url << " into " << path << LL_ENDL;
|
||||
|
||||
LLSD result = httpAdapter->getRawAndYield(self, httpRequest, url);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (status)
|
||||
{ // There was a newer feature table on the server. We've grabbed it and now should write it.
|
||||
// write to file
|
||||
const LLSD::Binary &raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary();
|
||||
|
||||
LL_INFOS() << "writing feature table to " << filename << LL_ENDL;
|
||||
|
||||
S32 size = raw.size();
|
||||
if (size > 0)
|
||||
{
|
||||
// write to file
|
||||
LLAPRFile out(filename, LL_APR_WB);
|
||||
out.write(raw.data(), size);
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fetch table(s) from a website (S3)
|
||||
void LLFeatureManager::fetchHTTPTables()
|
||||
{
|
||||
fetch_feature_table(FEATURE_TABLE_VER_FILENAME);
|
||||
LLCoros::instance().launch("LLFeatureManager::fetchFeatureTableCoro",
|
||||
boost::bind(&LLFeatureManager::fetchFeatureTableCoro, this, _1, FEATURE_TABLE_VER_FILENAME));
|
||||
}
|
||||
|
||||
|
||||
void LLFeatureManager::cleanupFeatureTables()
|
||||
{
|
||||
std::for_each(mMaskList.begin(), mMaskList.end(), DeletePairedPointer());
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@
|
|||
#include "llsingleton.h"
|
||||
#include "llstring.h"
|
||||
#include <map>
|
||||
#include "llcoros.h"
|
||||
#include "lleventcoro.h"
|
||||
|
||||
typedef enum EGPUClass
|
||||
{
|
||||
|
|
@ -164,6 +166,7 @@ protected:
|
|||
|
||||
void initBaseMask();
|
||||
|
||||
void fetchFeatureTableCoro(LLCoros::self& self, std::string name);
|
||||
|
||||
std::map<std::string, LLFeatureList *> mMaskList;
|
||||
std::set<std::string> mSkippedFeatures;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ void LLFlickrConnect::flickrConnectCoro(LLCoros::self& self, std::string request
|
|||
LLSD result = httpAdapter->putAndYield(self, httpRequest, getFlickrConnectURL("/connection"), body, httpOpts);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
@ -125,7 +125,7 @@ void LLFlickrConnect::flickrConnectCoro(LLCoros::self& self, std::string request
|
|||
bool LLFlickrConnect::testShareStatus(LLSD &result)
|
||||
{
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (status)
|
||||
return true;
|
||||
|
|
@ -270,7 +270,7 @@ void LLFlickrConnect::flickrDisconnectCoro(LLCoros::self& self)
|
|||
LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFlickrConnectURL("/connection"));
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status && (status != LLCore::HttpStatus(HTTP_NOT_FOUND)))
|
||||
{
|
||||
|
|
@ -302,7 +302,7 @@ void LLFlickrConnect::flickrConnectedCoro(LLCoros::self& self, bool autoConnect)
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, getFlickrConnectURL("/connection", true));
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
@ -350,7 +350,7 @@ void LLFlickrConnect::flickrInfoCoro(LLCoros::self& self)
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, getFlickrConnectURL("/info", true), httpOpts);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (status == LLCore::HttpStatus(HTTP_FOUND))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro(LLCoros::self&
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, url);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
LLUploadPermissionsObserver* observer = observerHandle.get();
|
||||
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ void startConfrenceCoro(LLCoros::self& self, std::string url,
|
|||
LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
@ -445,7 +445,7 @@ void chatterBoxInvitationCoro(LLCoros::self& self, std::string url, LLUUID sessi
|
|||
LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!gIMMgr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ void LLPathfindingManager::navMeshStatusRequestCoro(LLCoros::self& self, std::st
|
|||
region = LLWorld::getInstance()->getRegionFromHandle(regionHandle);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
LLPathfindingNavMeshStatus navMeshStatus(regionUUID);
|
||||
if (!status)
|
||||
|
|
@ -549,7 +549,7 @@ void LLPathfindingManager::navAgentStateRequestCoro(LLCoros::self& self, std::st
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, url);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
bool canRebake = false;
|
||||
if (!status)
|
||||
|
|
@ -581,7 +581,7 @@ void LLPathfindingManager::navMeshRebakeCoro(LLCoros::self& self, std::string ur
|
|||
LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
bool success = true;
|
||||
if (!status)
|
||||
|
|
@ -615,7 +615,7 @@ void LLPathfindingManager::linksetObjectsCoro(LLCoros::self &self, std::string u
|
|||
}
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
@ -651,7 +651,7 @@ void LLPathfindingManager::linksetTerrainCoro(LLCoros::self &self, std::string u
|
|||
}
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
@ -677,7 +677,7 @@ void LLPathfindingManager::charactersCoro(LLCoros::self &self, std::string url,
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, url);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(LLCoros::self& self, std:
|
|||
LLSD result = httpAdapter->postAndYield(self, httpRequest, url, bodyData);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
LLRemoteParcelInfoObserver* observer = observerHandle.get();
|
||||
// Panel inspecting the information may be closed and destroyed
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ void LLTwitterConnect::twitterConnectCoro(LLCoros::self& self, std::string reque
|
|||
LLSD result = httpAdapter->putAndYield(self, httpRequest, getTwitterConnectURL("/connection"), body, httpOpts);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
@ -125,7 +125,7 @@ void LLTwitterConnect::twitterConnectCoro(LLCoros::self& self, std::string reque
|
|||
bool LLTwitterConnect::testShareStatus(LLSD &result)
|
||||
{
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (status)
|
||||
return true;
|
||||
|
|
@ -257,7 +257,7 @@ void LLTwitterConnect::twitterDisconnectCoro(LLCoros::self& self)
|
|||
LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getTwitterConnectURL("/connection"));
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status && (status != LLCore::HttpStatus(HTTP_NOT_FOUND)))
|
||||
{
|
||||
|
|
@ -289,7 +289,7 @@ void LLTwitterConnect::twitterConnectedCoro(LLCoros::self& self, bool autoConnec
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, getTwitterConnectURL("/connection", true));
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
|
@ -337,7 +337,7 @@ void LLTwitterConnect::twitterInfoCoro(LLCoros::self& self)
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, getTwitterConnectURL("/info", true), httpOpts);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (status == LLCore::HttpStatus(HTTP_FOUND))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(LLCoros::self& self, U64 re
|
|||
}
|
||||
|
||||
LLSD httpResults = result["http_result"];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
if (!status)
|
||||
{
|
||||
LL_WARNS("AppInit", "Capabilities") << "HttpStatus error " << LL_ENDL;
|
||||
|
|
@ -385,7 +385,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(LLCoros::self& self
|
|||
result = httpAdapter->postAndYield(self, httpRequest, url, capabilityNames);
|
||||
|
||||
LLSD httpResults = result["http_result"];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
if (!status)
|
||||
{
|
||||
LL_WARNS("AppInit", "Capabilities") << "HttpStatus error " << LL_ENDL;
|
||||
|
|
@ -484,7 +484,7 @@ void LLViewerRegionImpl::requestSimulatorFeatureCoro(LLCoros::self& self, std::s
|
|||
LLSD result = httpAdapter->getAndYield(self, httpRequest, url);
|
||||
|
||||
LLSD httpResults = result["http_result"];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
if (!status)
|
||||
{
|
||||
LL_WARNS("AppInit", "SimulatorFeatures") << "HttpStatus error retrying" << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void LLEnvironmentRequest::environmentRequestCoro(LLCoros::self& self, std::stri
|
|||
}
|
||||
|
||||
LLSD httpResults = result["http_result"];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
if (!status)
|
||||
{
|
||||
LL_WARNS("WindlightCaps") << "Got an error, not using region windlight... " << LL_ENDL;
|
||||
|
|
@ -207,7 +207,7 @@ void LLEnvironmentApply::environmentApplyCoro(LLCoros::self& self, std::string u
|
|||
{ // Breaks from loop in the case of an error.
|
||||
|
||||
LLSD httpResults = result["http_result"];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
if (!status)
|
||||
{
|
||||
LL_WARNS("WindlightCaps") << "Couldn't apply windlight settings to region! " << LL_ENDL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue