Fixed: Infinite loop when HTTP error occurs
This commit is contained in:
parent
fe890b3728
commit
9ab3b7f253
1 changed files with 12 additions and 7 deletions
|
@ -356,6 +356,8 @@ void CDownloader::onHeadFinished()
|
||||||
|
|
||||||
void CDownloader::onDownloadFinished()
|
void CDownloader::onDownloadFinished()
|
||||||
{
|
{
|
||||||
|
int status = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
|
||||||
m_reply->deleteLater();
|
m_reply->deleteLater();
|
||||||
m_reply = NULL;
|
m_reply = NULL;
|
||||||
|
|
||||||
|
@ -366,6 +368,8 @@ void CDownloader::onDownloadFinished()
|
||||||
m_listener->operationStop();
|
m_listener->operationStop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (QFileInfo(m_fullPath).size() == m_size)
|
||||||
{
|
{
|
||||||
bool ok = NLMISC::CFile::setFileModificationDate(m_fullPath.toUtf8().constData(), m_lastModified.toTime_t());
|
bool ok = NLMISC::CFile::setFileModificationDate(m_fullPath.toUtf8().constData(), m_lastModified.toTime_t());
|
||||||
|
|
||||||
|
@ -373,6 +377,11 @@ void CDownloader::onDownloadFinished()
|
||||||
|
|
||||||
emit downloadDone();
|
emit downloadDone();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_listener->operationFail(tr("HTTP error: %1").arg(status));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDownloader::onError(QNetworkReply::NetworkError error)
|
void CDownloader::onError(QNetworkReply::NetworkError error)
|
||||||
|
@ -383,10 +392,6 @@ void CDownloader::onError(QNetworkReply::NetworkError error)
|
||||||
{
|
{
|
||||||
m_listener->operationStop();
|
m_listener->operationStop();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_listener->operationFail(tr("Network error: %1").arg(error));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDownloader::onDownloadProgress(qint64 current, qint64 total)
|
void CDownloader::onDownloadProgress(qint64 current, qint64 total)
|
||||||
|
|
Loading…
Reference in a new issue