summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/httpget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/httpget.cpp')
-rw-r--r--rbutil/rbutilqt/httpget.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/rbutil/rbutilqt/httpget.cpp b/rbutil/rbutilqt/httpget.cpp
index d1c80b8aff..1f9205e58b 100644
--- a/rbutil/rbutilqt/httpget.cpp
+++ b/rbutil/rbutilqt/httpget.cpp
@@ -129,7 +129,6 @@ bool HttpGet::getFile(const QUrl &url)
129 } 129 }
130 qDebug() << "request scheduled: GET" << getRequest; 130 qDebug() << "request scheduled: GET" << getRequest;
131 131
132 http.close();
133 return true; 132 return true;
134} 133}
135 134
@@ -137,7 +136,7 @@ bool HttpGet::getFile(const QUrl &url)
137void HttpGet::httpDone(bool error) 136void HttpGet::httpDone(bool error)
138{ 137{
139 if (error) { 138 if (error) {
140 qDebug() << "Error: " << qPrintable(http.errorString()) << endl; 139 qDebug() << "Error: " << qPrintable(http.errorString()) << httpResponse();
141 } 140 }
142 if(!outputToBuffer) 141 if(!outputToBuffer)
143 outputFile->close(); 142 outputFile->close();
@@ -173,7 +172,19 @@ void HttpGet::httpResponseHeader(const QHttpResponseHeader &resp)
173 // if there is a network error abort all scheduled requests for 172 // if there is a network error abort all scheduled requests for
174 // this download 173 // this download
175 response = resp.statusCode(); 174 response = resp.statusCode();
176 if(response != 200) http.abort(); 175 if(response != 200) {
176 qDebug() << "http response error:" << response << resp.reasonPhrase();
177 http.abort();
178 }
179 // 301 -- moved permanently
180 // 303 -- see other
181 // 307 -- moved temporarily
182 // in all cases, header: location has the correct address so we can follow.
183 if(response == 301 || response == 303 || response == 307) {
184 // start new request with new url
185 qDebug() << "http response" << response << "- following";
186 getFile(resp.value("location"));
187 }
177} 188}
178 189
179 190