diff options
Diffstat (limited to 'indra/viewer_components/updater')
6 files changed, 103 insertions, 55 deletions
diff --git a/indra/viewer_components/updater/llupdatechecker.cpp b/indra/viewer_components/updater/llupdatechecker.cpp index 0b105cc1b6..3e170e44f4 100755 --- a/indra/viewer_components/updater/llupdatechecker.cpp +++ b/indra/viewer_components/updater/llupdatechecker.cpp @@ -62,8 +62,7 @@ LLUpdateChecker::LLUpdateChecker(LLUpdateChecker::Client & client): } -void LLUpdateChecker::checkVersion(std::string const & hostUrl, - std::string const & servicePath, +void LLUpdateChecker::checkVersion(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -71,7 +70,7 @@ void LLUpdateChecker::checkVersion(std::string const & hostUrl, unsigned char uniqueid[MD5HEX_STR_SIZE], bool willing_to_test) { - mImplementation->checkVersion(hostUrl, servicePath, channel, version, platform, platform_version, uniqueid, willing_to_test); + mImplementation->checkVersion(urlBase, channel, version, platform, platform_version, uniqueid, willing_to_test); } @@ -98,8 +97,7 @@ LLUpdateChecker::Implementation::~Implementation() } -void LLUpdateChecker::Implementation::checkVersion(std::string const & hostUrl, - std::string const & servicePath, +void LLUpdateChecker::Implementation::checkVersion(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -111,8 +109,7 @@ void LLUpdateChecker::Implementation::checkVersion(std::string const & hostUrl, { mInProgress = true; - mHostUrl = hostUrl; - mServicePath = servicePath; + mUrlBase = urlBase; mChannel = channel; mVersion = version; mPlatform = platform; @@ -122,7 +119,7 @@ void LLUpdateChecker::Implementation::checkVersion(std::string const & hostUrl, mProtocol = sProtocolVersion; - std::string checkUrl = buildUrl(hostUrl, servicePath, channel, version, platform, platform_version, uniqueid, willing_to_test); + std::string checkUrl = buildUrl(urlBase, channel, version, platform, platform_version, uniqueid, willing_to_test); LL_INFOS("UpdaterService") << "checking for updates at " << checkUrl << LL_ENDL; mHttpClient.get(checkUrl, this); @@ -152,11 +149,40 @@ void LLUpdateChecker::Implementation::completed(U32 status, server_error += content["error_text"].asString(); } - LL_WARNS("UpdaterService") << "response error " << status - << " " << reason - << " (" << server_error << ")" - << LL_ENDL; - mClient.error(reason); + if (status == 404) + { + if (mProtocol == sProtocolVersion) + { + mProtocol = sLegacyProtocolVersion; + std::string retryUrl = buildUrl(mUrlBase, mChannel, mVersion, mPlatform, mPlatformVersion, mUniqueId, mWillingToTest); + + LL_WARNS("UpdaterService") + << "update response using " << sProtocolVersion + << " was HTTP 404 (" << server_error + << "); retry with legacy protocol " << mProtocol + << "\n at " << retryUrl + << LL_ENDL; + + mHttpClient.get(retryUrl, this); + } + else + { + LL_WARNS("UpdaterService") + << "update response using " << sLegacyProtocolVersion + << " was 404 (" << server_error + << "); request failed" + << LL_ENDL; + mClient.error(reason); + } + } + else + { + LL_WARNS("UpdaterService") << "response error " << status + << " " << reason + << " (" << server_error << ")" + << LL_ENDL; + mClient.error(reason); + } } else { @@ -173,8 +199,7 @@ void LLUpdateChecker::Implementation::error(U32 status, const std::string & reas } -std::string LLUpdateChecker::Implementation::buildUrl(std::string const & hostUrl, - std::string const & servicePath, +std::string LLUpdateChecker::Implementation::buildUrl(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -183,7 +208,6 @@ std::string LLUpdateChecker::Implementation::buildUrl(std::string const & hostUr bool willing_to_test) { LLSD path; - path.append(servicePath); path.append(mProtocol); path.append(channel); path.append(version); @@ -191,5 +215,5 @@ std::string LLUpdateChecker::Implementation::buildUrl(std::string const & hostUr path.append(platform_version); path.append(willing_to_test ? "testok" : "testno"); path.append((char*)uniqueid); - return LLURI::buildHTTP(hostUrl, path).asString(); + return LLURI::buildHTTP(urlBase, path).asString(); } diff --git a/indra/viewer_components/updater/llupdatechecker.h b/indra/viewer_components/updater/llupdatechecker.h index 8e85587490..4244007340 100755 --- a/indra/viewer_components/updater/llupdatechecker.h +++ b/indra/viewer_components/updater/llupdatechecker.h @@ -43,8 +43,7 @@ public: public: Implementation(Client & client); ~Implementation(); - void checkVersion(std::string const & hostUrl, - std::string const & servicePath, + void checkVersion(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -68,16 +67,14 @@ public: LLHTTPClient mHttpClient; bool mInProgress; std::string mVersion; - std::string mHostUrl; - std::string mServicePath; + std::string mUrlBase; std::string mChannel; std::string mPlatform; std::string mPlatformVersion; unsigned char mUniqueId[MD5HEX_STR_SIZE]; bool mWillingToTest; - std::string buildUrl(std::string const & hostUrl, - std::string const & servicePath, + std::string buildUrl(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -95,8 +92,7 @@ public: LLUpdateChecker(Client & client); // Check status of current app on the given host for the channel and version provided. - void checkVersion(std::string const & hostUrl, - std::string const & servicePath, + void checkVersion(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 1bd9fa4fc0..16950e1d62 100755 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -38,6 +38,7 @@ #include "lldir.h" #include "llsdserialize.h" #include "llfile.h" +#include "llviewernetwork.h" #if LL_WINDOWS #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally @@ -93,8 +94,6 @@ class LLUpdaterServiceImpl : static const std::string sListenerName; std::string mProtocolVersion; - std::string mUrl; - std::string mPath; std::string mChannel; std::string mVersion; std::string mPlatform; @@ -120,9 +119,7 @@ public: LLUpdaterServiceImpl(); virtual ~LLUpdaterServiceImpl(); - void initialize(const std::string& url, - const std::string& path, - const std::string& channel, + void initialize(const std::string& channel, const std::string& version, const std::string& platform, const std::string& platform_version, @@ -183,9 +180,7 @@ LLUpdaterServiceImpl::~LLUpdaterServiceImpl() LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); } -void LLUpdaterServiceImpl::initialize(const std::string& url, - const std::string& path, - const std::string& channel, +void LLUpdaterServiceImpl::initialize(const std::string& channel, const std::string& version, const std::string& platform, const std::string& platform_version, @@ -198,8 +193,6 @@ void LLUpdaterServiceImpl::initialize(const std::string& url, "while updater is running."); } - mUrl = url; - mPath = path; mChannel = channel; mVersion = version; mPlatform = platform; @@ -207,8 +200,6 @@ void LLUpdaterServiceImpl::initialize(const std::string& url, memcpy(mUniqueId, uniqueid, MD5HEX_STR_SIZE); mWillingToTest = willing_to_test; LL_DEBUGS("UpdaterService") - << "\n url: " << mUrl - << "\n path: " << mPath << "\n channel: " << mChannel << "\n version: " << mVersion << "\n uniqueid: " << mUniqueId @@ -228,7 +219,7 @@ void LLUpdaterServiceImpl::setBandwidthLimit(U64 bytesPerSecond) void LLUpdaterServiceImpl::startChecking(bool install_if_ready) { - if(mUrl.empty() || mChannel.empty() || mVersion.empty()) + if(mChannel.empty() || mVersion.empty()) { throw LLUpdaterService::UsageError("Set params before call to " "LLUpdaterService::startCheck()."); @@ -415,7 +406,7 @@ void LLUpdaterServiceImpl::response(LLSD const & content) setState(LLUpdaterService::UP_TO_DATE); } - else + else if ( content.isMap() && content.has("url") ) { // there is an update available... stopTimer(); @@ -439,6 +430,12 @@ void LLUpdaterServiceImpl::response(LLSD const & content) << LL_ENDL; mUpdateDownloader.download(url, content["hash"].asString(), mNewChannel, mNewVersion, more_info, required); } + else + { + LL_WARNS("UpdaterService") << "Invalid update query response ignored; retry in " + << mCheckPeriod << " seconds" << LL_ENDL; + restartTimer(mCheckPeriod); + } } void LLUpdaterServiceImpl::downloadComplete(LLSD const & data) @@ -565,8 +562,26 @@ bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event) } else { - mUpdateChecker.checkVersion(mUrl, mPath, mChannel, mVersion, mPlatform, mPlatformVersion, mUniqueId, mWillingToTest); - setState(LLUpdaterService::CHECKING_FOR_UPDATE); + std::string query_url = LLGridManager::getInstance()->getUpdateServiceURL(); + if ( !query_url.empty() ) + { + mUpdateChecker.checkVersion(query_url, mChannel, mVersion, + mPlatform, mPlatformVersion, mUniqueId, + mWillingToTest); + setState(LLUpdaterService::CHECKING_FOR_UPDATE); + } + else + { + LL_WARNS("UpdaterService") + << "No updater service defined for grid '" << LLGridManager::getInstance()->getGrid() + << "' will check again in " << mCheckPeriod << " seconds" + << LL_ENDL; + // Because the grid can be changed after the viewer is started (when the first check takes place) + // but before the user logs in, the next check may be on a different grid, so set the retry timer + // even though this check did not happen. The default time is once an hour, and if we're not + // doing the check anyway the performance impact is completely insignificant. + restartTimer(mCheckPeriod); + } } } else @@ -610,9 +625,7 @@ LLUpdaterService::~LLUpdaterService() { } -void LLUpdaterService::initialize(const std::string& url, - const std::string& path, - const std::string& channel, +void LLUpdaterService::initialize(const std::string& channel, const std::string& version, const std::string& platform, const std::string& platform_version, @@ -620,7 +633,7 @@ void LLUpdaterService::initialize(const std::string& url, const bool& willing_to_test ) { - mImpl->initialize(url, path, channel, version, platform, platform_version, uniqueid, willing_to_test); + mImpl->initialize(channel, version, platform, platform_version, uniqueid, willing_to_test); } void LLUpdaterService::setCheckPeriod(unsigned int seconds) diff --git a/indra/viewer_components/updater/llupdaterservice.h b/indra/viewer_components/updater/llupdaterservice.h index 982f99b861..0ddf24935b 100755 --- a/indra/viewer_components/updater/llupdaterservice.h +++ b/indra/viewer_components/updater/llupdaterservice.h @@ -71,9 +71,7 @@ public: LLUpdaterService(); ~LLUpdaterService(); - void initialize(const std::string& url, - const std::string& path, - const std::string& channel, + void initialize(const std::string& channel, const std::string& version, const std::string& platform, const std::string& platform_version, diff --git a/indra/viewer_components/updater/scripts/linux/update_install b/indra/viewer_components/updater/scripts/linux/update_install index a9df9042fd..03089f192e 100755 --- a/indra/viewer_components/updater/scripts/linux/update_install +++ b/indra/viewer_components/updater/scripts/linux/update_install @@ -69,8 +69,11 @@ then # zenity on PATH and is executable # clear any previous message clear_message # put up a new zenity box and capture its pid - "$zenpath" --info --title "Second Life Viewer Updater" \ - --width=320 --height=120 --text="$*" & +## "$zenpath" --info --title "Second Life Viewer Updater" \ +## --width=320 --height=120 --text="$*" & + # MAINT-2333: use bouncing progress bar + "$zenpath" --progress --pulsate --no-cancel --title "Second Life Viewer Updater" \ + --width=320 --height=120 --text "$*" </dev/null & statuspid=$! } diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index 4812272ebc..759e41ef4c 100755 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -44,8 +44,7 @@ *****************************************************************************/ LLUpdateChecker::LLUpdateChecker(LLUpdateChecker::Client & client) {} -void LLUpdateChecker::checkVersion(std::string const & hostUrl, - std::string const & servicePath, +void LLUpdateChecker::checkVersion(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -91,6 +90,21 @@ bool LLDir::setCacheDir(const std::string &path){ return true; } void LLDir::dumpCurrentDirectories() {} void LLDir::updatePerAccountChatLogsDir() {} +#include "llviewernetwork.h" +LLGridManager::LLGridManager() : + mGrid("test.grid.lindenlab.com"), + mIsInProductionGrid(false) +{ +} +std::string LLGridManager::getUpdateServiceURL() +{ + return "https://update.secondlife.com/update"; +} +LLGridManager::~LLGridManager() +{ +} + + std::string LLDir::getExpandedFilename(ELLPath location, const std::string &filename) const { @@ -179,10 +193,10 @@ namespace tut try { unsigned char id1[MD5HEX_STR_SIZE] = "11111111111111111111111111111111"; - updater.initialize(test_url, "update" ,test_channel, test_version, "win", "1.2.3", id1, true); + updater.initialize(test_channel, test_version, "win", "1.2.3", id1, true); updater.startChecking(); unsigned char id2[MD5HEX_STR_SIZE] = "22222222222222222222222222222222"; - updater.initialize("other_url", "update", test_channel, test_version, "win", "4.5.6", id2, true); + updater.initialize(test_channel, test_version, "win", "4.5.6", id2, true); } catch(LLUpdaterService::UsageError) { @@ -197,7 +211,7 @@ namespace tut DEBUG; LLUpdaterService updater; unsigned char id[MD5HEX_STR_SIZE] = "33333333333333333333333333333333"; - updater.initialize(test_url, "update", test_channel, test_version, "win", "7.8.9", id, true); + updater.initialize(test_channel, test_version, "win", "7.8.9", id, true); updater.startChecking(); ensure(updater.isChecking()); updater.stopChecking(); |