diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-10-18 01:00:46 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-10-18 01:00:46 +0200 |
commit | 205570be32b5cbd40eeb2b7e2d8d4fe116b07f64 (patch) | |
tree | 7af19a7479ae0c1dbef4d9cbc65c5550f9a3adc1 /logic/net/CacheDownload.cpp | |
parent | a600286e33601a85949b9e51bd5421a45f9998ac (diff) | |
download | MultiMC-205570be32b5cbd40eeb2b7e2d8d4fe116b07f64.tar MultiMC-205570be32b5cbd40eeb2b7e2d8d4fe116b07f64.tar.gz MultiMC-205570be32b5cbd40eeb2b7e2d8d4fe116b07f64.tar.lz MultiMC-205570be32b5cbd40eeb2b7e2d8d4fe116b07f64.tar.xz MultiMC-205570be32b5cbd40eeb2b7e2d8d4fe116b07f64.zip |
Support version format 9, fix version-related segfault, (maybe) fix forge lists.
Diffstat (limited to 'logic/net/CacheDownload.cpp')
-rw-r--r-- | logic/net/CacheDownload.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/logic/net/CacheDownload.cpp b/logic/net/CacheDownload.cpp index 6a76a4ae..309eb345 100644 --- a/logic/net/CacheDownload.cpp +++ b/logic/net/CacheDownload.cpp @@ -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); |