summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2008-05-17 19:36:54 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2008-05-17 19:36:54 +0000
commite338fc9130407ea01fa9c8c2244b6d2a69cd0921 (patch)
tree27f6a8a62f674f89173f8008084b99fe1f9c3169
parentbe28f8441b84765caf334d1f5f0b3fe50b3b6b35 (diff)
downloadrockbox-e338fc9130407ea01fa9c8c2244b6d2a69cd0921.tar.gz
rockbox-e338fc9130407ea01fa9c8c2244b6d2a69cd0921.zip
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
-rw-r--r--rbutil/rbutilqt/httpget.cpp5
-rw-r--r--rbutil/rbutilqt/httpget.h8
2 files changed, 9 insertions, 4 deletions
diff --git a/rbutil/rbutilqt/httpget.cpp b/rbutil/rbutilqt/httpget.cpp
index fcc2d4163c..a1385c5755 100644
--- a/rbutil/rbutilqt/httpget.cpp
+++ b/rbutil/rbutilqt/httpget.cpp
@@ -25,13 +25,14 @@
25 25
26QDir HttpGet::m_globalCache; //< global cach path value for new objects 26QDir HttpGet::m_globalCache; //< global cach path value for new objects
27QUrl HttpGet::m_globalProxy; //< global proxy value for new objects 27QUrl HttpGet::m_globalProxy; //< global proxy value for new objects
28bool HttpGet::m_globalDumbCache = false; //< globally set cache "dumb" mode
28 29
29HttpGet::HttpGet(QObject *parent) 30HttpGet::HttpGet(QObject *parent)
30 : QObject(parent) 31 : QObject(parent)
31{ 32{
32 outputToBuffer = true; 33 outputToBuffer = true;
33 m_cached = false; 34 m_cached = false;
34 m_noHeaderCheck = false; 35 m_dumbCache = m_globalDumbCache;
35 getRequest = -1; 36 getRequest = -1;
36 // if a request is cancelled before a reponse is available return some 37 // if a request is cancelled before a reponse is available return some
37 // hint about this in the http response instead of nonsense. 38 // hint about this in the http response instead of nonsense.
@@ -199,7 +200,7 @@ bool HttpGet::getFile(const QUrl &url)
199 m_hash = QCryptographicHash::hash(url.toEncoded(), QCryptographicHash::Md5).toHex(); 200 m_hash = QCryptographicHash::hash(url.toEncoded(), QCryptographicHash::Md5).toHex();
200 m_path = QString(QUrl::toPercentEncoding(url.path(), "/")); 201 m_path = QString(QUrl::toPercentEncoding(url.path(), "/"));
201 202
202 if(m_noHeaderCheck || !m_usecache) { 203 if(m_dumbCache || !m_usecache) {
203 getFileFinish(); 204 getFileFinish();
204 } 205 }
205 else { 206 else {
diff --git a/rbutil/rbutilqt/httpget.h b/rbutil/rbutilqt/httpget.h
index acf86ddb95..2b3faf18cb 100644
--- a/rbutil/rbutilqt/httpget.h
+++ b/rbutil/rbutilqt/httpget.h
@@ -44,11 +44,14 @@ class HttpGet : public QObject
44 int httpResponse(void); 44 int httpResponse(void);
45 QByteArray readAll(void); 45 QByteArray readAll(void);
46 bool isCached() { return m_cached; } 46 bool isCached() { return m_cached; }
47 void setNoHeaderCheck(bool b) { m_noHeaderCheck = b; } //< disable checking of http header timestamp for caching 47 void setDumbCache(bool b) //< disable checking of http header timestamp for caching
48 { m_dumbCache = b; }
48 static void setGlobalCache(const QDir d) //< set global cache path 49 static void setGlobalCache(const QDir d) //< set global cache path
49 { m_globalCache = d; } 50 { m_globalCache = d; }
50 static void setGlobalProxy(const QUrl p) //< set global proxy value 51 static void setGlobalProxy(const QUrl p) //< set global proxy value
51 { m_globalProxy = p; } 52 { m_globalProxy = p; }
53 static void setGlobalDumbCache(bool b) //< set "dumb" (ignore server status) caching mode
54 { m_globalDumbCache = b; }
52 55
53 public slots: 56 public slots:
54 void abort(void); 57 void abort(void);
@@ -84,11 +87,12 @@ class HttpGet : public QObject
84 QUrl m_proxy; 87 QUrl m_proxy;
85 static QDir m_globalCache; //< global cache path value 88 static QDir m_globalCache; //< global cache path value
86 static QUrl m_globalProxy; //< global proxy value 89 static QUrl m_globalProxy; //< global proxy value
90 static bool m_globalDumbCache; //< cache "dumb" mode global setting
87 QDateTime m_serverTimestamp; //< timestamp of file on server 91 QDateTime m_serverTimestamp; //< timestamp of file on server
88 QString m_query; //< constructed query to pass http getter 92 QString m_query; //< constructed query to pass http getter
89 QString m_path; //< constructed path to pass http getter 93 QString m_path; //< constructed path to pass http getter
90 QString m_hash; //< caching hash 94 QString m_hash; //< caching hash
91 bool m_noHeaderCheck; //< true if caching should ignore the server header 95 bool m_dumbCache; //< true if caching should ignore the server header
92}; 96};
93 97
94#endif 98#endif