MAINT-6612 Server release notes in Help -> About Second Life never fetch on any region.

master
andreykproductengine 2016-08-08 21:31:11 +03:00
parent 6c56c9bf67
commit f4f30dae0f
2 changed files with 52 additions and 23 deletions

View File

@ -198,6 +198,7 @@ Ansariel Hiller
MAINT-6552
STORM-2133
MAINT-6511
MAINT-6612
Aralara Rajal
Arare Chantilly
CHUIBUG-191

View File

@ -108,6 +108,7 @@ private:
static const std::string sCheckUpdateListenerName;
static void startFetchServerReleaseNotes();
static void fetchServerReleaseNotesCoro(const std::string& cap_url);
static void handleServerReleaseNotes(LLSD results);
};
@ -224,35 +225,62 @@ void LLFloaterAbout::startFetchServerReleaseNotes()
// an URL suitable for external browsers in the "Location:" HTTP header.
std::string cap_url = region->getCapability("ServerReleaseNotes");
LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpGet(cap_url,
&LLFloaterAbout::handleServerReleaseNotes, &LLFloaterAbout::handleServerReleaseNotes);
LLCoros::instance().launch("fetchServerReleaseNotesCoro", boost::bind(&LLFloaterAbout::fetchServerReleaseNotesCoro, cap_url));
}
/*static*/
void LLFloaterAbout::fetchServerReleaseNotesCoro(const std::string& cap_url)
{
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("fetchServerReleaseNotesCoro", LLCore::HttpRequest::DEFAULT_POLICY_ID));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
httpOpts->setWantHeaders(true);
httpOpts->setFollowRedirects(false);
LLSD result = httpAdapter->getAndSuspend(httpRequest, cap_url, httpOpts);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
{
handleServerReleaseNotes(httpResults);
}
else
{
handleServerReleaseNotes(result);
}
}
/*static*/
void LLFloaterAbout::handleServerReleaseNotes(LLSD results)
{
// LLFloaterAbout* floater_about = LLFloaterReg::getTypedInstance<LLFloaterAbout>("sl_about");
// if (floater_about)
// {
LLSD http_headers;
if (results.has(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS))
{
LLSD http_results = results[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
http_headers = http_results[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS];
}
else
{
http_headers = results[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS];
}
std::string location = http_headers[HTTP_IN_HEADER_LOCATION].asString();
if (location.empty())
{
location = LLTrans::getString("ErrorFetchingServerReleaseNotesURL");
}
LLAppViewer::instance()->setServerReleaseNotesURL(location);
// }
LLSD http_headers;
if (results.has(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS))
{
LLSD http_results = results[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
http_headers = http_results[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS];
}
else
{
http_headers = results[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS];
}
std::string location = http_headers[HTTP_IN_HEADER_LOCATION].asString();
if (location.empty())
{
location = LLTrans::getString("ErrorFetchingServerReleaseNotesURL");
}
LLAppViewer::instance()->setServerReleaseNotesURL(location);
LLFloaterAbout* floater_about = LLFloaterReg::getTypedInstance<LLFloaterAbout>("sl_about");
if (floater_about)
{
floater_about->setSupportText(location);
}
}
class LLFloaterAboutListener: public LLEventAPI