diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-03-10 05:00:57 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-03-10 05:00:57 (GMT) |
commit | 3863b79be5e0d6a86a2313a1015aebb2c84ed1bf (patch) | |
tree | eba80f4e8be27e16b6163e212e9209e9e0878341 /src/declarative/qml | |
parent | 954ff8673c1b9913697ecdeec355f2b0f9e4633a (diff) | |
download | Qt-3863b79be5e0d6a86a2313a1015aebb2c84ed1bf.zip Qt-3863b79be5e0d6a86a2313a1015aebb2c84ed1bf.tar.gz Qt-3863b79be5e0d6a86a2313a1015aebb2c84ed1bf.tar.bz2 |
URL redirection for components resources.
Task-number: QTBUG-7515
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qdeclarativecompositetypemanager.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp index 6f41963..9b3a8b4 100644 --- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp +++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp @@ -282,6 +282,24 @@ void QDeclarativeCompositeTypeManager::resourceReplyFinished() QDeclarativeCompositeTypeResource *resource = resources.value(reply->url()); Q_ASSERT(resource); + redirectCount++; + if (redirectCount < TYPEMANAGER_MAXIMUM_REDIRECT_RECURSION) { + QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); + if (redirect.isValid()) { + QUrl url = reply->url().resolved(redirect.toUrl()); + redirects.insert(reply->url(),url); + resource->url = url.toString(); + resources.remove(reply->url()); + resources.insert(url, resource); + reply->deleteLater(); + reply = engine->networkAccessManager()->get(QNetworkRequest(url)); + QObject::connect(reply, SIGNAL(finished()), + this, SLOT(resourceReplyFinished())); + return; + } + } + redirectCount = 0; + if (reply->error() != QNetworkReply::NoError) { resource->status = QDeclarativeCompositeTypeResource::Error; |