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

List:       kfm-devel
Subject:    Re: [PATCH]Automatic proxy configuration
From:       Malte Starostik <malte () kde ! org>
Date:       2001-07-30 12:20:30
[Download RAW message or body]

Am Montag, 30. Juli 2001 07:12 schrieb Waldo Bastian:
> Hiya,
>
> My kfmclient crashes on the automatic proxy config stuff. The following
> patch seems to solve it. The problem may be related to the fact that the
> actual script causes a parse error.
Feel free to send me the script :)
I don't think that causes the crash though, I can reproduce it with a working 
script now. Patch looks good and solves the crash, I don't really see how it 
works though :(

How can KProtocolManager::pac() be reentered between 
+    d->init_busy = true;
and the former
-        d->pac = create_pac();
-        // Need to set d->pac here to avoid infinite recursion
or wasn't that the problem?

> I also notice that a job is created to "download" the script. That seems
> unnecassery since the script is in a local file.
In most cases those scripts are on a web server. Anyway, please review the 
attachted patch.

-- 
Malte Starostik
PGP: 1024D/D2F3C787 [C138 2121 FAF3 410A 1C2A  27CD 5431 7745 D2F3 C787]

["kpac.diff" (text/x-diff)]

Index: kpac_downloader.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kpac/kpac_downloader.cpp,v
retrieving revision 1.1
diff -u -3 -d -p -r1.1 kpac_downloader.cpp
--- kpac_downloader.cpp	2001/05/14 18:02:28	1.1
+++ kpac_downloader.cpp	2001/07/30 12:19:38
@@ -18,6 +18,8 @@
 
 // $Id: kpac_downloader.cpp,v 1.1 2001/05/14 18:02:28 malte Exp $
 
+#include <qfile.h>
+
 #include <kapp.h>
 #include <kio/job.h>
 
@@ -32,6 +34,17 @@ KPACDownloader::KPACDownloader()
 bool KPACDownloader::download(const KURL &url)
 {
     m_data = 0;
+    if (url.isLocalFile())
+    {
+        QFile f(url.path());
+        if (f.open(IO_ReadOnly))
+        {
+            m_data.resize(f.size());
+            f.readBlock(m_data.data(), f.size());
+            return true;
+        }
+        return false;
+    }
     m_working = true;
     KIO::TransferJob *job = KIO::get(url, false /* no reload */, false /* no GUI \
                */);
     connect(job, SIGNAL(data(KIO::Job *, const QByteArray &)), \
                SLOT(slotData(KIO::Job *, const QByteArray &)));
Index: kpac_impl.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kpac/kpac_impl.cpp,v
retrieving revision 1.15
diff -u -3 -d -p -r1.15 kpac_impl.cpp
--- kpac_impl.cpp	2001/07/04 14:21:34	1.15
+++ kpac_impl.cpp	2001/07/30 12:19:39
@@ -131,7 +131,7 @@ bool KPACImpl::init(const KURL &url)
         m_downloader = new KPACDownloader;
 
     if (m_downloader->download(url))
-    {
+    {kdDebug(7025) << "Script is: " << m_downloader->data() << endl;
         if (!m_kjs)
         {
             m_kjs = new KJScript();



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

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