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

List:       kde-core-devel
Subject:    [PATCH] fix proxy autodetection with webdav urls.
From:       Till Adam <adam () kde ! org>
Date:       2005-03-03 8:27:57
Message-ID: 200503030928.02315.adam () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Heya, 

Helge Deller has alerted me to a problem with autodetecting proxy settings for 
webdav urls which the attached patch (mostly also by Helge) fixes. Could 
someone familiar with this stuff have a look if it's ok, please (artfully 
disregarding the superfluous kdebug.h include I forgot to remove and which I 
will not apply)? The idea is to rewrite webdav urls to http, basically, in 
the proxy detection code, since may sites will provide autodetection scripts 
which don't include entries for webdav, as Windows appears to simply use http 
for most things. It might be possible and even sensible to do this higher up 
in KProtocolmanager::proxyForURL, but I can't really judge that.

Till

["kio-proxy-autoconfig-with-webdav.diff" (text/x-diff)]

Index: kio/kprotocolmanager.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/kprotocolmanager.cpp,v
retrieving revision 1.141
diff -u -3 -p -r1.141 kprotocolmanager.cpp
--- kio/kprotocolmanager.cpp	17 Feb 2005 11:18:43 -0000	1.141
+++ kio/kprotocolmanager.cpp	3 Mar 2005 18:38:27 -0000
@@ -247,7 +247,7 @@ 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" || p == "webdav" )
               DCOPRef( "kded", "proxyscout" ).call( "proxyForURL", url ).get( proxy );
           }
           break;
Index: misc/kpac/proxyscout.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/misc/kpac/proxyscout.cpp,v
retrieving revision 1.7
diff -u -3 -p -r1.7 proxyscout.cpp
--- misc/kpac/proxyscout.cpp	21 Nov 2004 22:51:58 -0000	1.7
+++ misc/kpac/proxyscout.cpp	3 Mar 2005 18:38:27 -0000
@@ -24,6 +24,7 @@
 #include <dcopclient.h>
 #include <kapplication.h>
 #include <klocale.h>
+#include <kdebug.h>
 #include <knotifyclient.h>
 #include <kprotocolmanager.h>
 
@@ -148,7 +149,18 @@ namespace KPAC
     {
         try
         {
-            QString result = m_script->evaluate( url );
+            QString result;
+            if ( KDE_ISUNLIKELY( url.protocol().startsWith("webdav") ) ) {
+                KURL newurl( url );
+                if ( url.protocol() == "webdav" )
+                    newurl.setProtocol( "http" );
+                else
+                    newurl.setProtocol( "https" );
+                // try with webdav(s) translated to http(s)
+                result = m_script->evaluate( newurl );
+            } else {
+                result = m_script->evaluate( url );
+            }
             QStringList proxies = QStringList::split( ';', result );
             for ( QStringList::ConstIterator it = proxies.begin();
                   it != proxies.end(); ++it )

[Attachment #6 (application/pgp-signature)]

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

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