diff options
Diffstat (limited to 'src/utilities/fqterm_http.cpp')
-rw-r--r-- | src/utilities/fqterm_http.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/utilities/fqterm_http.cpp b/src/utilities/fqterm_http.cpp index 57cde46..7ea61cc 100644 --- a/src/utilities/fqterm_http.cpp +++ b/src/utilities/fqterm_http.cpp @@ -95,16 +95,15 @@ void FQTermHttp::getLink(const QUrl& url, bool preview) { FQ_VERIFY(connect(netreply_.data(), SIGNAL(metaDataChanged()), this, SLOT(httpResponse()))); } -void FQTermHttp::httpResponse() {
+void FQTermHttp::httpResponse() { if (netreply_->hasRawHeader("Location")) { - //FIXME: according to RC, this code still could not work - //if the server send the relative location. - QString realLocation = netreply_->header(QNetworkRequest::LocationHeader).toString();
- QUrl u = realLocation;
- if (u.isRelative() ) {
- u=netreply_->url().resolved(u);
- }
- cacheFileName_ = QFileInfo(u.path()).fileName(); // update filename
+ // use rawHeader("Location") instead of header(QNetworkRequest::LocationHeader) + // it works for both absolute and relative redirection + QUrl u(netreply_->rawHeader("Location")); + if (u.isRelative() ) { + u=netreply_->url().resolved(u); + } + cacheFileName_ = QFileInfo(u.path()).fileName(); // update filename getLink(u,isPreview_); return; } |