diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2007-08-15 20:30:36 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2007-08-15 20:30:36 +0000 |
commit | 53fbd6d01dc921c203860523649df59033751ca9 (patch) | |
tree | 696a613b7943b7f5733bb490f005525c38d917ba /rbutil | |
parent | 57dd552e003481a3d08afd7a8ea1be11f4390ce2 (diff) | |
download | rockbox-53fbd6d01dc921c203860523649df59033751ca9.tar.gz rockbox-53fbd6d01dc921c203860523649df59033751ca9.zip |
302 is also a valid redirect. Also keep the original query when redirecting.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14362 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/rbutilqt/httpget.cpp | 6 | ||||
-rw-r--r-- | rbutil/rbutilqt/httpget.h | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/rbutil/rbutilqt/httpget.cpp b/rbutil/rbutilqt/httpget.cpp index 1f9205e58b..60c8a58a6d 100644 --- a/rbutil/rbutilqt/httpget.cpp +++ b/rbutil/rbutilqt/httpget.cpp | |||
@@ -111,7 +111,6 @@ bool HttpGet::getFile(const QUrl &url) | |||
111 | http.setHost(url.host(), url.port(80)); | 111 | http.setHost(url.host(), url.port(80)); |
112 | // construct query (if any) | 112 | // construct query (if any) |
113 | QList<QPair<QString, QString> > qitems = url.queryItems(); | 113 | QList<QPair<QString, QString> > qitems = url.queryItems(); |
114 | QString query; | ||
115 | if(url.hasQuery()) { | 114 | if(url.hasQuery()) { |
116 | query = "?"; | 115 | query = "?"; |
117 | for(int i = 0; i < qitems.size(); i++) | 116 | for(int i = 0; i < qitems.size(); i++) |
@@ -177,13 +176,14 @@ void HttpGet::httpResponseHeader(const QHttpResponseHeader &resp) | |||
177 | http.abort(); | 176 | http.abort(); |
178 | } | 177 | } |
179 | // 301 -- moved permanently | 178 | // 301 -- moved permanently |
179 | // 302 -- found | ||
180 | // 303 -- see other | 180 | // 303 -- see other |
181 | // 307 -- moved temporarily | 181 | // 307 -- moved temporarily |
182 | // in all cases, header: location has the correct address so we can follow. | 182 | // in all cases, header: location has the correct address so we can follow. |
183 | if(response == 301 || response == 303 || response == 307) { | 183 | if(response == 301 || response == 302 || response == 303 || response == 307) { |
184 | // start new request with new url | 184 | // start new request with new url |
185 | qDebug() << "http response" << response << "- following"; | 185 | qDebug() << "http response" << response << "- following"; |
186 | getFile(resp.value("location")); | 186 | getFile(resp.value("location") + query); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
diff --git a/rbutil/rbutilqt/httpget.h b/rbutil/rbutilqt/httpget.h index fe8ee3fc52..86eddf9df6 100644 --- a/rbutil/rbutilqt/httpget.h +++ b/rbutil/rbutilqt/httpget.h | |||
@@ -64,6 +64,7 @@ class HttpGet : public QObject | |||
64 | int getRequest; | 64 | int getRequest; |
65 | QByteArray dataBuffer; | 65 | QByteArray dataBuffer; |
66 | bool outputToBuffer; | 66 | bool outputToBuffer; |
67 | QString query; | ||
67 | }; | 68 | }; |
68 | 69 | ||
69 | #endif | 70 | #endif |