summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/httpget.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2015-12-18 23:05:13 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2015-12-18 23:42:17 +0100
commitd24a9ea3b2eaec28e44608bfc50d02cb14cea51b (patch)
tree9eb2bf3a52559b1b45d7f226fab03bb660f42b07 /rbutil/rbutilqt/base/httpget.cpp
parent4627d4b56e63e5689ad6ffd652636f112081a0ea (diff)
downloadrockbox-d24a9ea3b2eaec28e44608bfc50d02cb14cea51b.tar.gz
rockbox-d24a9ea3b2eaec28e44608bfc50d02cb14cea51b.tar.bz2
rockbox-d24a9ea3b2eaec28e44608bfc50d02cb14cea51b.zip
Add support file:// URLs in HttpGet.
QNetworkAccessManager can handle file:// URLs without additional work. Make HttpGet aware of that so you can now also use it to retrieve file:// URLs. Add a unit test for it as well. Change-Id: If64b57453460b70bca9e5b0c725bb78344617bcd
Diffstat (limited to 'rbutil/rbutilqt/base/httpget.cpp')
-rw-r--r--rbutil/rbutilqt/base/httpget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/base/httpget.cpp b/rbutil/rbutilqt/base/httpget.cpp
index 4b08faf33b..4d10301bc0 100644
--- a/rbutil/rbutilqt/base/httpget.cpp
+++ b/rbutil/rbutilqt/base/httpget.cpp
@@ -17,7 +17,6 @@
****************************************************************************/
#include <QtNetwork>
-#include <QtDebug>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
@@ -155,7 +154,10 @@ void HttpGet::requestFinished(QNetworkReply* reply)
startRequest(url);
return;
}
- else if(m_lastStatusCode == 200) {
+ else if(m_lastStatusCode == 200 ||
+ (reply->url().isLocalFile() && reply->error() == 0)) {
+ // callers might not be aware if the request is file:// so fake 200.
+ m_lastStatusCode = 200;
m_data = reply->readAll();
if(m_outputFile && m_outputFile->open(QIODevice::WriteOnly)) {
m_outputFile->write(m_data);