From 641cc695108a06ce328d6876da51e33ec74abf67 Mon Sep 17 00:00:00 2001 From: bluebrother Date: Wed, 15 Aug 2007 20:30:36 +0000 Subject: [PATCH] 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 --- rbutil/rbutilqt/httpget.cpp | 6 +++--- 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 1f9205e58..60c8a58a6 100644 --- a/rbutil/rbutilqt/httpget.cpp +++ b/rbutil/rbutilqt/httpget.cpp @@ -111,7 +111,6 @@ bool HttpGet::getFile(const QUrl &url) http.setHost(url.host(), url.port(80)); // construct query (if any) QList > qitems = url.queryItems(); - QString query; if(url.hasQuery()) { query = "?"; for(int i = 0; i < qitems.size(); i++) @@ -177,13 +176,14 @@ void HttpGet::httpResponseHeader(const QHttpResponseHeader &resp) http.abort(); } // 301 -- moved permanently + // 302 -- found // 303 -- see other // 307 -- moved temporarily // in all cases, header: location has the correct address so we can follow. - if(response == 301 || response == 303 || response == 307) { + if(response == 301 || response == 302 || response == 303 || response == 307) { // start new request with new url qDebug() << "http response" << response << "- following"; - getFile(resp.value("location")); + getFile(resp.value("location") + query); } } diff --git a/rbutil/rbutilqt/httpget.h b/rbutil/rbutilqt/httpget.h index fe8ee3fc5..86eddf9df 100644 --- a/rbutil/rbutilqt/httpget.h +++ b/rbutil/rbutilqt/httpget.h @@ -64,6 +64,7 @@ class HttpGet : public QObject int getRequest; QByteArray dataBuffer; bool outputToBuffer; + QString query; }; #endif -- 2.11.4.GIT