From c5e29fafee2dd397cb99f57bbf22c35abf33c81e Mon Sep 17 00:00:00 2001 From: bluebrother Date: Sat, 17 May 2008 19:36:54 +0000 Subject: [PATCH] Allow http caching to use the old dumb mode again. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17560 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/rbutilqt/httpget.cpp | 5 +++-- rbutil/rbutilqt/httpget.h | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/rbutil/rbutilqt/httpget.cpp b/rbutil/rbutilqt/httpget.cpp index fcc2d4163..a1385c575 100644 --- a/rbutil/rbutilqt/httpget.cpp +++ b/rbutil/rbutilqt/httpget.cpp @@ -25,13 +25,14 @@ QDir HttpGet::m_globalCache; //< global cach path value for new objects QUrl HttpGet::m_globalProxy; //< global proxy value for new objects +bool HttpGet::m_globalDumbCache = false; //< globally set cache "dumb" mode HttpGet::HttpGet(QObject *parent) : QObject(parent) { outputToBuffer = true; m_cached = false; - m_noHeaderCheck = false; + m_dumbCache = m_globalDumbCache; getRequest = -1; // if a request is cancelled before a reponse is available return some // hint about this in the http response instead of nonsense. @@ -199,7 +200,7 @@ bool HttpGet::getFile(const QUrl &url) m_hash = QCryptographicHash::hash(url.toEncoded(), QCryptographicHash::Md5).toHex(); m_path = QString(QUrl::toPercentEncoding(url.path(), "/")); - if(m_noHeaderCheck || !m_usecache) { + if(m_dumbCache || !m_usecache) { getFileFinish(); } else { diff --git a/rbutil/rbutilqt/httpget.h b/rbutil/rbutilqt/httpget.h index acf86ddb9..2b3faf18c 100644 --- a/rbutil/rbutilqt/httpget.h +++ b/rbutil/rbutilqt/httpget.h @@ -44,11 +44,14 @@ class HttpGet : public QObject int httpResponse(void); QByteArray readAll(void); bool isCached() { return m_cached; } - void setNoHeaderCheck(bool b) { m_noHeaderCheck = b; } //< disable checking of http header timestamp for caching + void setDumbCache(bool b) //< disable checking of http header timestamp for caching + { m_dumbCache = b; } static void setGlobalCache(const QDir d) //< set global cache path { m_globalCache = d; } static void setGlobalProxy(const QUrl p) //< set global proxy value { m_globalProxy = p; } + static void setGlobalDumbCache(bool b) //< set "dumb" (ignore server status) caching mode + { m_globalDumbCache = b; } public slots: void abort(void); @@ -84,11 +87,12 @@ class HttpGet : public QObject QUrl m_proxy; static QDir m_globalCache; //< global cache path value static QUrl m_globalProxy; //< global proxy value + static bool m_globalDumbCache; //< cache "dumb" mode global setting QDateTime m_serverTimestamp; //< timestamp of file on server QString m_query; //< constructed query to pass http getter QString m_path; //< constructed path to pass http getter QString m_hash; //< caching hash - bool m_noHeaderCheck; //< true if caching should ignore the server header + bool m_dumbCache; //< true if caching should ignore the server header }; #endif -- 2.11.4.GIT