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
This commit is contained in:
Dominik Riebeling 2008-05-17 19:36:54 +00:00
parent be28f8441b
commit e338fc9130
2 changed files with 9 additions and 4 deletions

View file

@ -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 {

View file

@ -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