diff options
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/rbutilqt/httpget.cpp | 5 | ||||
-rw-r--r-- | 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 fcc2d4163c..a1385c5755 100644 --- a/rbutil/rbutilqt/httpget.cpp +++ b/rbutil/rbutilqt/httpget.cpp | |||
@@ -25,13 +25,14 @@ | |||
25 | 25 | ||
26 | QDir HttpGet::m_globalCache; //< global cach path value for new objects | 26 | QDir HttpGet::m_globalCache; //< global cach path value for new objects |
27 | QUrl HttpGet::m_globalProxy; //< global proxy value for new objects | 27 | QUrl HttpGet::m_globalProxy; //< global proxy value for new objects |
28 | bool HttpGet::m_globalDumbCache = false; //< globally set cache "dumb" mode | ||
28 | 29 | ||
29 | HttpGet::HttpGet(QObject *parent) | 30 | HttpGet::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 |