[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kio/kio
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2010-01-31 23:36:23
Message-ID: 1264980983.158681.23935.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1083288 by adawit:

Factor out the check for content allowed into its own function and restored the check \
for the 'data' protocol

 M  +11 -3     accessmanager.cpp  


--- trunk/KDE/kdelibs/kio/kio/accessmanager.cpp #1083287:1083288
@@ -45,6 +45,7 @@
 public:
     AccessManagerPrivate():externalContentAllowed(true) {}
     KIO::MetaData metaDataForRequest(QNetworkRequest request);
+    bool isRequestAllowed(const QUrl& url) const;
 
     bool externalContentAllowed;
     KIO::MetaData requestMetaData;
@@ -122,8 +123,8 @@
 {
     KIO::SimpleJob *kioJob = 0;
 
-    if ( !d->externalContentAllowed && req.url().scheme() != "file" && \
                !req.url().scheme().isEmpty() ) {
-        kDebug( 7044 ) << "Blocked: " << req.url().scheme() <<  req.url();
+    if ( !d->isRequestAllowed(req.url()) ) {
+        kDebug( 7044 ) << "Blocked: " << req.url();
         /* if kioJob equals zero, the AccessManagerReply will block the request */
         return new KDEPrivate::AccessManagerReply(op, req, kioJob, this);
     }
@@ -173,7 +174,6 @@
     return reply;
 }
 
-
 KIO::MetaData AccessManager::AccessManagerPrivate::metaDataForRequest(QNetworkRequest \
request)  {
     KIO::MetaData metaData;
@@ -235,7 +235,15 @@
     return metaData;
 }
 
+bool AccessManager::AccessManagerPrivate::isRequestAllowed(const QUrl& url) const
+{
+    const QString scheme (url.scheme());
 
+    return (externalContentAllowed && !scheme.isEmpty() &&
+            scheme != QLatin1String("file")  && scheme != QLatin1String("data"));
+}
+
+
 using namespace KIO::Integration;
 
 CookieJar::CookieJar(QObject* parent)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic