Auto-Update improvements: Now we query InternetGetConnectedState() before testing the Internet connection. This avoids a lengthy connection test on computers that are offline anyway. Moreover the connection test will now prevent HTTP redirection. This is required, because some ISP's redirect to a "search page" if the DNS lookup fails - rather than triggering a connection error (which is what they are supposed to do!). Also added a few more hosts to the list of known hosts.

This commit is contained in:
LoRd_MuldeR 2011-05-09 22:22:15 +02:00
parent 70b097c380
commit 738d8ee21e
15 changed files with 144 additions and 16 deletions

View File

@ -89,7 +89,7 @@
</ClCompile>
<Link>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type=%27win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27 processorArchitecture=%27*%27" %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>qtmaind.lib;QtCored4.lib;QtGuid4.lib;Winmm.lib;Shlwapi.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>qtmaind.lib;QtCored4.lib;QtGuid4.lib;Winmm.lib;Shlwapi.lib;Wininet.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(QTDIR)\lib;$(QTDIR)\plugins\imageformats;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
@ -140,7 +140,7 @@ copy "$(QTDIR)\plugins\imageformats\q????d4.dll" "$(TargetDir)imageformats\"
</ClCompile>
<Link>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type=%27win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27 processorArchitecture=%27*%27" %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>qtmain.lib;QtCore4.lib;QtGui4.lib;Winmm.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>qtmain.lib;QtCore4.lib;QtGui4.lib;Winmm.lib;Shlwapi.lib;Wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>LinkVerboseLib</ShowProgress>
<Version>
</Version>
@ -203,7 +203,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
</ClCompile>
<Link>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type=%27win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27 processorArchitecture=%27*%27" %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>qtmain.lib;QtCore.lib;QtGui.lib;QtSvg.lib;qgif.lib;qsvg.lib;qico.lib;Winmm.lib;imm32.lib;ws2_32.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>qtmain.lib;QtCore.lib;QtGui.lib;QtSvg.lib;qgif.lib;qsvg.lib;qico.lib;Winmm.lib;imm32.lib;ws2_32.lib;Shlwapi.lib;Wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>LinkVerboseLib</ShowProgress>
<AdditionalLibraryDirectories>$(SolutionDir)\etc\Prerequisites\qt4_static\lib;$(SolutionDir)\etc\Prerequisites\qt4_static\plugins\imageformats;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>

View File

@ -1854,6 +1854,14 @@
<source>Testing your internet connection, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Network connectivity test has failed!</source>
<translation type="unfinished"></translation>

View File

@ -1915,5 +1915,13 @@
<source>Update failed. Please try again or download manually!</source>
<translation>Update fehlgeschlagen. Bitte versuchen Sie es noch einmal!</translation>
</message>
<message>
<source>It appears that the computer currently is offline!</source>
<translation>Anscheinend ist der Computer momentan offline!</translation>
</message>
<message>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation>Aktivieren Sie Ihre Internetverbindung und versuchen Sie es dann noch einmal.</translation>
</message>
</context>
</TS>

View File

@ -1914,5 +1914,13 @@
<source>Update failed. Please try again or download manually!</source>
<translation>Actualización fallida. ¡Por favor, vuelva a intentarlo o descárguelo manualmente!</translation>
</message>
<message>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1924,5 +1924,13 @@ Ouvrir le dossier récursivement...</translation>
<source>Update failed. Please try again or download manually!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1915,5 +1915,13 @@
<source>Update failed. Please try again or download manually!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1914,5 +1914,13 @@
<source>Update failed. Please try again or download manually!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1917,5 +1917,13 @@
<source>Update failed. Please try again or download manually!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1914,5 +1914,13 @@
<source>Update failed. Please try again or download manually!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1,7 +1,7 @@
@echo off
REM ---------------------------
call "..\Deployment\_paths.bat"
call "%PATH_QTMSVC%\bin\qtvars.bat"
call "%PATH_QTMSVC%\bin\qtenv2.bat"
REM ---------------------------
for %%f in (LameXP_??.ts) do (
lrelease.exe %%f -qm ..\..\res\localization\%%~nf.qm

View File

@ -1,7 +1,7 @@
@echo off
REM ---------------------------
call "..\Deployment\_paths.bat"
call "%PATH_QTMSVC%\bin\qtvars.bat"
call "%PATH_QTMSVC%\bin\qtenv2.bat"
REM ---------------------------
del update.lst > NUL
REM ---------------------------

Binary file not shown.

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 14
#define VER_LAMEXP_BUILD 496
#define VER_LAMEXP_BUILD 499
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -40,6 +40,7 @@
#include <time.h>
#include <MMSystem.h>
#include <WinInet.h>
///////////////////////////////////////////////////////////////////////////////
@ -69,13 +70,36 @@ static const char *known_hosts[] =
{
"http://www.amazon.com/",
"http://www.aol.com/",
"http://www.ask.com/",
"http://www.apache.org/",
"http://www.avidemux.org/",
"http://www.bbc.co.uk/",
"http://www.bing.com/",
"http://www.ebay.com/",
"http://www.example.com/",
"http://www.equation.com/",
"http://www.ffmpeg.org/",
"http://www.gitorious.org/",
"http://www.google.com/",
"http://www.msn.com/",
"http://www.gnome.org/",
"http://www.gnu.org/",
"http://code.google.com/",
"http://haali.su/mkv/",
"http://www.heise.de/",
"http://www.iana.org/",
"http://www.imgburn.com/",
"http://www.kernel.org/",
"http://www.libav.org/",
"http://www.mozilla.org/",
"http://mplayerhq.hu/",
"http://www.msn.com/?st=1",
"http://oss.netfarm.it/",
"http://www.opera.com/",
"http://www.quakelive.com/",
"http://www.seamonkey-project.org/",
"http://sourceforge.net/",
"http://www.spiegel.de/",
"http://tdm-gcc.tdragon.net/",
"http://www.tdrsmusic.com/",
"http://www.videohelp.com/",
"http://www.videolan.org/",
"http://www.wikipedia.org/",
"http://www.yahoo.com/",
"http://www.youtube.com/",
@ -260,6 +284,31 @@ void UpdateDialog::checkForUpdates(void)
m_logFile->clear();
m_logFile->append("Checking internet connection...");
DWORD inetFlags = NULL;
if(!InternetGetConnectedState(&inetFlags, NULL))
{
m_logFile->append(QStringList() << "" << "Operating system reports that the computer is currently offline !!!");
if(!retryButton->isVisible()) retryButton->show();
if(!logButton->isVisible()) logButton->show();
closeButton->setEnabled(true);
retryButton->setEnabled(true);
logButton->setEnabled(true);
if(frameAnimation->isVisible()) frameAnimation->hide();
statusLabel->setText(tr("It appears that the computer currently is offline!"));
progressBar->setValue(progressBar->maximum());
hintIcon->setPixmap(QIcon(":/icons/network_error.png").pixmap(16,16));
hintLabel->setText(tr("Please make sure your computer is connected to the internet and try again."));
hintIcon->show();
hintLabel->show();
LAMEXP_DELETE(m_updateInfo);
if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_ERROR), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
QApplication::restoreOverrideCursor();
progressBar->setValue(progressBar->maximum());
WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarErrorState);
WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/exclamation.png"));
return;
}
QStringList hostList;
for(int i = 0; known_hosts[i]; i++)
{
@ -275,12 +324,17 @@ void UpdateDialog::checkForUpdates(void)
{
m_logFile->append(QStringList() << "" << "Testing host:" << currentHost << "");
QString outFile = QString("%1/%2.htm").arg(lamexp_temp_folder2(), lamexp_rand_str());
if(getFile(currentHost, outFile))
if(getFile(currentHost, outFile, 0))
{
connectionScore++;
}
QFile::remove(outFile);
}
else
{
QApplication::processEvents();
Sleep(15);
}
}
if(connectionScore < MIN_CONNSCORE)
@ -307,7 +361,7 @@ void UpdateDialog::checkForUpdates(void)
}
statusLabel->setText(tr("Checking for new updates online, please wait..."));
m_logFile->append("Checking for updates online...");
m_logFile->append(QStringList() << "" << "----" << "" << "Checking for updates online...");
QStringList mirrorList;
for(int i = 0; update_mirrors[i]; i++)
@ -332,6 +386,11 @@ void UpdateDialog::checkForUpdates(void)
success = true;
}
}
else
{
QApplication::processEvents();
Sleep(15);
}
}
QApplication::restoreOverrideCursor();
@ -445,7 +504,7 @@ bool UpdateDialog::tryUpdateMirror(UpdateInfo *updateInfo, const QString &url)
return success;
}
bool UpdateDialog::getFile(const QString &url, const QString &outFile)
bool UpdateDialog::getFile(const QString &url, const QString &outFile, unsigned int maxRedir)
{
QFileInfo output(outFile);
output.setCaching(false);
@ -464,6 +523,11 @@ bool UpdateDialog::getFile(const QString &url, const QString &outFile)
process.setReadChannel(QProcess::StandardOutput);
process.setWorkingDirectory(output.absolutePath());
QStringList args;
args << "--no-cache" << "--no-dns-cache" << QString().sprintf("--max-redirect=%u", maxRedir);
args << QString("--referer=%1://%2/").arg(QUrl(url).scheme(), QUrl(url).host()) << "-U" << USER_AGENT_STR;
args << "-O" << output.fileName() << url;
QEventLoop loop;
connect(&process, SIGNAL(error(QProcess::ProcessError)), &loop, SLOT(quit()));
connect(&process, SIGNAL(finished(int,QProcess::ExitStatus)), &loop, SLOT(quit()));
@ -474,7 +538,7 @@ bool UpdateDialog::getFile(const QString &url, const QString &outFile)
timer.setInterval(15000);
connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
process.start(m_binaryWGet, QStringList() << "-U" << USER_AGENT_STR << "-O" << output.fileName() << url);
process.start(m_binaryWGet, args);
if(!process.waitForStarted())
{

View File

@ -57,7 +57,7 @@ protected:
private:
bool tryUpdateMirror(UpdateInfo *updateInfo, const QString &url);
bool getFile(const QString &url, const QString &outFile);
bool getFile(const QString &url, const QString &outFile, unsigned int maxRedir = 5);
bool checkSignature(const QString &file, const QString &signature);
bool parseVersionInfo(const QString &file, UpdateInfo *updateInfo);