From c089696d8de41762a1e8abb067b2721ce3de4d27 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 14 Oct 2010 15:46:22 +0200 Subject: QNAM: Do not need QNetworkSession for data:// This was already fixed in 4.8, this is a hotfix for 4.7 Task-Number: QT-4096 Reviewed-by: Olivier Goffart --- src/network/access/qnetworkaccessmanager.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index a637474..12fe094 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -944,6 +944,22 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera { Q_D(QNetworkAccessManager); + // 4.7 only hotfix fast path for data:// URLs + // In 4.8 this is solved with QNetworkReplyDataImpl and will work there + // This hotfix is done for not needing a QNetworkSession for data:// + if ((op == QNetworkAccessManager::GetOperation || op == QNetworkAccessManager::HeadOperation) + && (req.url().scheme() == QLatin1String("data"))) { + QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); + QNetworkReplyImplPrivate *priv = reply->d_func(); + priv->manager = this; + priv->backend = new QNetworkAccessDataBackend(); + priv->backend->manager = this->d_func(); + priv->backend->setParent(reply); + priv->backend->reply = priv; + priv->setup(op, req, outgoingData); + return reply; + } + // fast path for GET on file:// URLs // Also if the scheme is empty we consider it a file. // The QNetworkAccessFileBackend will right now only be used for PUT -- cgit v0.12