[Chinese-commits] [fqterm] 17/34: Fix relative redirection problem

Boyuan Yang hosiet-guest at moszumanska.debian.org
Tue Nov 1 06:06:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

hosiet-guest pushed a commit to branch master
in repository fqterm.

commit d421c2285d63d31a9c5a036b523eeaa3dcacc41b
Author: Iru Cai <mytbk920423 at gmail.com>
Date:   Tue Aug 9 20:13:38 2016 +0800

    Fix relative redirection problem
---
 src/utilities/fqterm_http.cpp | 17 ++++++++---------
 1 file 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;
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/chinese/fqterm.git



More information about the Chinese-commits mailing list