Skip to content

Commit

Permalink
Merge pull request #58 from bruderstein/fix-pluginlist-download
Browse files Browse the repository at this point in the history
Fix issue with plugin list download
  • Loading branch information
bruderstein authored Apr 12, 2017
2 parents 823120a + b2b9a5f commit e76bd3c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
25 changes: 20 additions & 5 deletions pluginManager/src/PluginList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,18 +904,21 @@ void PluginList::downloadList()
}
else
{
downloadResult = downloadManager.getUrl(PLUGINS_MD5_URL, serverMD5, &g_options.moduleInfo);
TCHAR *md5Url = getPluginsMd5Url();
downloadResult = downloadManager.getUrl(md5Url, serverMD5, &g_options.moduleInfo);
}
#else
// OSes less than vista don't support SNI, which cloudflare uses to support HTTPS, so we have to use HTTP on old OSes
TCHAR *md5Url = (g_options.forceHttp || g_winVer < WV_VISTA) ? PLUGINS_HTTP_MD5_URL : PLUGINS_MD5_URL;
TCHAR *md5Url = getPluginsMd5Url();
BOOL downloadResult = downloadManager.getUrl(md5Url, serverMD5, &g_options.moduleInfo);
#endif

std::shared_ptr<char> cHashBuffer = WcharMbcsConverter::tchar2char(hashBuffer);


if (downloadResult && serverMD5 != cHashBuffer.get())
if (downloadResult && serverMD5 == cHashBuffer.get()) {
// Server hash matches local hash, so we're ok to continue
downloadSuccess = TRUE;
}
else if (downloadResult && serverMD5 != cHashBuffer.get())
{
// If the build is allowing to override the download URL, then use the one from options
// Also, don't unzip it - assume if it's overridden, it's a test version and hence easier to treat it
Expand Down Expand Up @@ -963,6 +966,18 @@ void PluginList::downloadList()

}

TCHAR* PluginList::getPluginsMd5Url() {
if (g_options.useDevPluginList) {
return DEV_PLUGINS_MD5_URL;
}

if (g_options.forceHttp || g_winVer < WV_VISTA) {
return PLUGINS_HTTP_MD5_URL;
}

return PLUGINS_MD5_URL;
}

TCHAR* PluginList::getPluginsUrl() {
if (g_options.useDevPluginList) {
return DEV_PLUGINS_URL;
Expand Down
1 change: 1 addition & 0 deletions pluginManager/src/PluginList.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,6 @@ class PluginList
void addSteps(Plugin* plugin, TiXmlElement* installElement, InstallOrRemove ior);

TCHAR *getPluginsUrl();
TCHAR *getPluginsMd5Url();
TCHAR *getValidateUrl();
};

0 comments on commit e76bd3c

Please sign in to comment.