diff options
author | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2010-05-10 10:39:52 (GMT) |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2010-05-10 12:27:45 (GMT) |
commit | 0828b63ce77846f14994f7c47468f0db8b42fbd4 (patch) | |
tree | 7897439b1720b950e5e13a73c8376d4bb6600238 /src/network | |
parent | aec71b27ccf4a9513c474bdbe9d65de5fb5fbdc1 (diff) | |
download | Qt-0828b63ce77846f14994f7c47468f0db8b42fbd4.zip Qt-0828b63ce77846f14994f7c47468f0db8b42fbd4.tar.gz Qt-0828b63ce77846f14994f7c47468f0db8b42fbd4.tar.bz2 |
Revert "Use QUrl::isLocalFile and fix the scheme checking in local URLs."
This reverts commit ebddf7a8739d7f4aaa7d9cb8a41a14eebb65e4f4.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkaccessfilebackend.cpp | 11 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessmanager.cpp | 11 |
2 files changed, 9 insertions, 13 deletions
diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 710c258..4560153 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -65,15 +65,10 @@ QNetworkAccessFileBackendFactory::create(QNetworkAccessManager::Operation op, } QUrl url = request.url(); - if (url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) == 0 || url.isLocalFile()) { + if (url.scheme() == QLatin1String("qrc") || !url.toLocalFile().isEmpty()) return new QNetworkAccessFileBackend; - } else if (!url.scheme().isEmpty() && url.authority().isEmpty()) { - // check if QFile could, in theory, open this URL via the file engines - // it has to be in the format: - // prefix:path/to/file - // or prefix:/path/to/file - // - // this construct here must match the one below in open() + else if (!url.isEmpty() && url.authority().isEmpty()) { + // check if QFile could, in theory, open this URL QFileInfo fi(url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery)); if (fi.exists() || (op == QNetworkAccessManager::PutOperation && fi.dir().exists())) return new QNetworkAccessFileBackend; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 10fdc6f..1c7661d 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -907,20 +907,21 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera { Q_D(QNetworkAccessManager); - bool isLocalFile = req.url().isLocalFile(); - // 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 or qrc:// if ((op == QNetworkAccessManager::GetOperation || op == QNetworkAccessManager::HeadOperation) - && isLocalFile) { + && (req.url().scheme() == QLatin1String("file") + || req.url().scheme().isEmpty())) { return new QFileNetworkReply(this, req, op); } #ifndef QT_NO_BEARERMANAGEMENT // Return a disabled network reply if network access is disabled. // Except if the scheme is empty or file://. - if (!d->networkAccessible && !isLocalFile) { + if (!d->networkAccessible && !(req.url().scheme() == QLatin1String("file") || + req.url().scheme().isEmpty())) { return new QDisabledNetworkReply(this, req, op); } @@ -962,7 +963,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera QUrl url = request.url(); QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); #ifndef QT_NO_BEARERMANAGEMENT - if (!isLocalFile) { + if (req.url().scheme() != QLatin1String("file") && !req.url().scheme().isEmpty()) { connect(this, SIGNAL(networkSessionConnected()), reply, SLOT(_q_networkSessionConnected())); } |