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

List:       kde-core-devel
Subject:    [patch] Making KDE work with (web based) proxy scripts again
From:       Scott Wheeler <wheeler () kde ! org>
Date:       2004-01-13 19:51:32
Message-ID: 200401132051.32107.wheeler () kde ! org
[Download RAW message or body]

For some time at work we've been unable to use KDE's autoconfiguration based 
on a specific URL.  This was reported in bug #69026.

The basic problem is that kded is that when Konq browses to a certain URL 
KProtocolManager::proxyForURL() is called on that URL which queries kded for 
the proxy.  kded then finds out that the file it's looking for 
(http://proxy:8083) is using the http protocol, so it calls 
KProtocolManager::proxyForURL() to determine how to fetch itself.  ;-)

This would probably end up as an infinite loop if there wasn't a wait call in 
one of the DCOP calls.

The attach patch makes sure that if proxyForURL() is called on 
proxyConfigScript() (in our case http://proxy:8083) that it returns "DIRECT" 
rather than trying to look up the proxy to handle that with.

Also along the way I realized that KURL::url() (and as such KURL::equals()) 
doesn't actually strip or add the trailing slash as indicated by the optional 
parameter in the case that there is no path.  i.e.

KURL("http://proxy:8083").equals("http://proxy:8083/"), true) == false

I'm guessing that the change to KURL is wrong, because it seems like for the 
way it was coded that there must be something that assume trailingSlash() 
won't strip or append a slash if the path is empty, but since that's 
counterintuitive I'll leave that to someone else to confirm.

Thoughts?  IMHO having this broken is a pretty big deal...

-Scott

-- 
Audience Member: "What is the book [on CS] that you most want to read?"
Donald Knuth: "It's not `The Art of Computer Programming for Dummies.`"

["fix-proxy-config.patch" (text/x-diff)]

Index: kdecore/kurl.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kurl.cpp,v
retrieving revision 1.263
diff -u -3 -p -r1.263 kurl.cpp
--- kdecore/kurl.cpp	11 Jan 2004 18:46:10 -0000	1.263
+++ kdecore/kurl.cpp	13 Jan 2004 19:36:20 -0000
@@ -1223,15 +1223,13 @@ static QString trailingSlash( int _trail
   {
     int len = result.length();
     if ( len == 0 )
-      result = QString::null;
+      result = QString::fromLatin1( "/" );
     else if ( result[ len - 1 ] != '/' )
       result += "/";
     return result;
   }
   else if ( _trailing == -1 )
   {
-    if ( result == "/" )
-      return result;
     int len = result.length();
     if ( len != 0 && result[ len - 1 ] == '/' )
       result.truncate( len - 1 );
Index: kio/kio/kprotocolmanager.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/kprotocolmanager.cpp,v
retrieving revision 1.134
diff -u -3 -p -r1.134 kprotocolmanager.cpp
--- kio/kio/kprotocolmanager.cpp	11 Jan 2004 16:19:52 -0000	1.134
+++ kio/kio/kprotocolmanager.cpp	13 Jan 2004 19:36:20 -0000
@@ -245,7 +245,8 @@ QString KProtocolManager::proxyForURL( c
           if (!url.host().isEmpty())
           {
             QString p = url.protocol();
-            if ( p.startsWith( "http" ) || p == "ftp" || p == "gopher" )
+            if ( ( p.startsWith( "http" ) || p == "ftp" || p == "gopher" ) &&
+                 ! url.equals( proxyConfigScript(), true ) )
               DCOPRef( "kded", "proxyscout" ).call( "proxyForURL", url ).get( proxy );
           }
           break;


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

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