Support version format 9, fix version-related segfault, (maybe) fix forge lists.

This commit is contained in:
Petr Mrázek
2013-10-18 01:00:46 +02:00
parent a600286e33
commit 205570be32
6 changed files with 27 additions and 10 deletions

View File

@ -33,7 +33,11 @@ void CacheDownload::start()
}
QLOG_INFO() << "Downloading " << m_url.toString();
QNetworkRequest request(m_url);
request.setRawHeader(QString("If-None-Match").toLatin1(), m_entry->etag.toLatin1());
if(m_entry->remote_changed_timestamp.size())
request.setRawHeader(QString("If-Modified-Since").toLatin1(), m_entry->remote_changed_timestamp.toLatin1());
if(m_entry->etag.size())
request.setRawHeader(QString("If-None-Match").toLatin1(), m_entry->etag.toLatin1());
request.setHeader(QNetworkRequest::UserAgentHeader,"MultiMC/5.0 (Cached)");
auto worker = MMC->qnam();
@ -87,7 +91,11 @@ void CacheDownload::downloadFinished()
QFileInfo output_file_info(m_target_path);
m_entry->etag = m_reply->rawHeader("ETag").constData();
m_entry->last_changed_timestamp =
if(m_reply->hasRawHeader("Last-Modified"))
{
m_entry->remote_changed_timestamp = m_reply->rawHeader("Last-Modified").constData();
}
m_entry->local_changed_timestamp =
output_file_info.lastModified().toUTC().toMSecsSinceEpoch();
m_entry->stale = false;
MMC->metacache()->updateEntry(m_entry);