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

List:       kde-commits
Subject:    =?utf-8?q?=5Bkdelibs/KDE/4=2E6=5D_kio/kio=3A_Do_not_wait_until_a?=
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2011-06-20 15:49:34
Message-ID: 20110620154934.9F463A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit f5ff6a74142d3855b88c4bbccf504a04db21a67d by Dawit Alemayehu.
Committed on 18/06/2011 at 20:23.
Pushed by adawit into branch 'KDE/4.6'.

Do not wait until an ioslave is finished to update other ioslaves with the
internal meta-data information it sent. Otherwise, the internal meta-data
might not be available to newly created ioslaves.

Note that this improves commit e2d099586cd29cbae87ef3c4dddba6881153859b and
is required to make the address spoofing security warning in kio_http work
properly for all kdewebkit based browsers.

CCBUG: 94867

(cherry picked from commit c76097820a11d6e7015c8395f704d79386edbde1)

M  +7    -0    kio/kio/job.cpp     
M  +26   -14   kio/kio/scheduler.cpp     
M  +7    -0    kio/kio/scheduler.h     

http://commits.kde.org/kdelibs/f5ff6a74142d3855b88c4bbccf504a04db21a67d

diff --git a/kio/kio/job.cpp b/kio/kio/job.cpp
index 7d905fb..c3b670c 100644
--- a/kio/kio/job.cpp
+++ b/kio/kio/job.cpp
@@ -599,6 +599,13 @@ void SimpleJob::slotMetaData( const KIO::MetaData &_metaData )
         else
             d->m_incomingMetaData.insert(it.key(), it.value());
     }
+
+    // Update the internal meta-data values as soon as possible. Waiting until
+    // the ioslave is finished has unintended consequences if the client starts
+    // a new connection without waiting for the ioslave to finish.
+    if (!d->m_internalMetaData.isEmpty()) {
+        Scheduler::updateInternalMetaData(this);
+    }
 }
 
 void SimpleJob::storeSSLSessionFromJob(const KUrl &redirectionURL)
diff --git a/kio/kio/scheduler.cpp b/kio/kio/scheduler.cpp
index 9f5607e..e4fd699 100644
--- a/kio/kio/scheduler.cpp
+++ b/kio/kio/scheduler.cpp
@@ -700,6 +700,7 @@ public:
     void publishSlaveOnHold();
     Slave *heldSlaveForJob(KIO::SimpleJob *job);
     void registerWindow(QWidget *wid);
+    void updateInternalMetaData(SimpleJob* job);
 
     MetaData metaDataFor(const QString &protocol, const QString &proxy, const KUrl \
                &url);
     void setupSlave(KIO::Slave *slave, const KUrl &url, const QString &protocol,
@@ -811,6 +812,11 @@ void Scheduler::publishSlaveOnHold()
     schedulerPrivate->publishSlaveOnHold();
 }
 
+void Scheduler::updateInternalMetaData(SimpleJob* job)
+{
+    schedulerPrivate->updateInternalMetaData(job);
+}
+
 KIO::Slave *Scheduler::getConnectedSlave(const KUrl &url,
         const KIO::MetaData &config )
 {
@@ -978,19 +984,6 @@ void SchedulerPrivate::jobFinished(SimpleJob *job, Slave *slave)
 
     KIO::SimpleJobPrivate *const jobPriv = SimpleJobPrivate::get(job);
 
-    // Preserve all internal meta-data so they can be sent back to the
-    // ioslaves as needed...
-    const KUrl jobUrl = job->url();
-    QMapIterator<QString, QString> it (jobPriv->m_internalMetaData);
-    while (it.hasNext()) {
-        it.next();
-        if (it.key().startsWith(QLatin1String("{internal~currenthost}"), \
                Qt::CaseInsensitive)) {
-            SlaveConfig::self()->setConfigData(jobUrl.protocol(), jobUrl.host(), \
                it.key().mid(22), it.value());
-        } else if (it.key().startsWith(QLatin1String("{internal~allhosts}"), \
                Qt::CaseInsensitive)) {
-            SlaveConfig::self()->setConfigData(jobUrl.protocol(), QString(), \
                it.key().mid(19), it.value());
-        }
-    }
-
     // make sure that we knew about the job!
     Q_ASSERT(jobPriv->m_schedSerial);
 
@@ -1007,7 +1000,7 @@ void SchedulerPrivate::jobFinished(SimpleJob *job, Slave \
*slave)  while (it.hasNext()) {
                     Slave* runningSlave = it.next();
                     if (slave->host() == runningSlave->host()) {
-                        slave->setConfig(metaDataFor(slave->protocol(), \
jobPriv->m_proxy, jobUrl)); +                        \
                slave->setConfig(metaDataFor(slave->protocol(), jobPriv->m_proxy, \
                job->url()));
                         kDebug(7006) << "Updated configuration of" << \
                slave->protocol()
                                      << "ioslave, pid=" << slave->slave_pid();
                     }
@@ -1289,5 +1282,24 @@ void SchedulerPrivate::slotUnregisterWindow(QObject *obj)
        call(QDBus::NoBlock, "unregisterWindowId", qlonglong(windowId));
 }
 
+void SchedulerPrivate::updateInternalMetaData(SimpleJob* job)
+{
+    KIO::SimpleJobPrivate *const jobPriv = SimpleJobPrivate::get(job);
+    // Preserve all internal meta-data so they can be sent back to the
+    // ioslaves as needed...
+    const KUrl jobUrl = job->url();
+    kDebug(7006) << job << jobPriv->m_internalMetaData;
+    QMapIterator<QString, QString> it (jobPriv->m_internalMetaData);
+    while (it.hasNext()) {
+        it.next();
+        if (it.key().startsWith(QLatin1String("{internal~currenthost}"), \
Qt::CaseInsensitive)) { +            \
SlaveConfig::self()->setConfigData(jobUrl.protocol(), jobUrl.host(), \
it.key().mid(22), it.value()); +        } else if \
(it.key().startsWith(QLatin1String("{internal~allhosts}"), Qt::CaseInsensitive)) { +  \
SlaveConfig::self()->setConfigData(jobUrl.protocol(), QString(), it.key().mid(19), \
it.value()); +        }
+    }
+}
+
+
 #include "scheduler.moc"
 #include "scheduler_p.moc"
diff --git a/kio/kio/scheduler.h b/kio/kio/scheduler.h
index ea12c3f..55a5f2a 100644
--- a/kio/kio/scheduler.h
+++ b/kio/kio/scheduler.h
@@ -266,6 +266,13 @@ namespace KIO {
 
         static void emitReparseSlaveConfiguration();
 
+        /**
+         * Updates the internal metadata from job.
+         *
+         * @since 4.6.5
+         */
+        static void updateInternalMetaData(SimpleJob* job);
+
     Q_SIGNALS:
         void slaveConnected(KIO::Slave *slave);
         void slaveError(KIO::Slave *slave, int error, const QString &errorMsg);


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

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