forked from qt-creator/qt-creator
CPaster: Inform about a permanent redirect
Helps to keep track of the current workaround and replace it again with using the updated URL on a permanent move. Change-Id: I913dbd7be18d77c9a8d52f1dd931cc5b30320fa2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -56,7 +56,12 @@ void DPasteDotComProtocol::fetchFinished(const QString &id, QNetworkReply * cons
|
||||
const int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
if (status >= 300 && status <= 308 && status != 306) {
|
||||
if (!alreadyRedirected) {
|
||||
QNetworkReply * const newRep = httpGet(QString::fromUtf8(reply->rawHeader("Location")));
|
||||
const QString location = QString::fromUtf8(reply->rawHeader("Location"));
|
||||
if (status == 301 || status == 308) {
|
||||
const QString m = QString("HTTP redirect (%1) to \"%2\"").arg(status).arg(location);
|
||||
Core::MessageManager::write(m, Core::MessageManager::ModeSwitch);
|
||||
}
|
||||
QNetworkReply * const newRep = httpGet(location);
|
||||
connect(newRep, &QNetworkReply::finished, this, [this, id, newRep] {
|
||||
fetchFinished(id, newRep, true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user