[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.4/kdemultimedia/juk
From: Michael Pyne <michael.pyne () kdemail ! net>
Date: 2005-10-05 21:46:21
Message-ID: 1128548781.880584.29018.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 467659 by mpyne:
Backport fix for bug 107517 (JuK ignores MusicBrainz proxy exceptions) to KDE 3.4. \
Should be in KDE 3.4.3.
I've also fixed it for 3.5 but forgot to CC the bug.
Thanks to Thiago for advice on the implementation.
BUG:107517
M +49 -2 ktrm.cpp
--- branches/KDE/3.4/kdemultimedia/juk/ktrm.cpp #467658:467659
@@ -24,11 +24,13 @@
#if HAVE_MUSICBRAINZ
#include <kapplication.h>
+#include <kresolver.h>
#include <kprotocolmanager.h>
#include <kurl.h>
#include <kdebug.h>
#include <qmutex.h>
+#include <qregexp.h>
#include <qevent.h>
#include <qobject.h>
#include <qfile.h>
@@ -121,9 +123,52 @@
tp_SetUseUTF8(m_pimp, true);
tp_SetNotifyCallback(m_pimp, TRMNotifyCallback, 0);
+ // Re-read proxy config.
+ KProtocolManager::reparseConfiguration();
+
if(KProtocolManager::useProxy()) {
- KURL proxy = KProtocolManager::proxyFor("http");
- tp_SetProxy(m_pimp, proxy.host().latin1(), short(proxy.port()));
+ // split code copied from kcm_kio.
+ QString noProxiesFor = KProtocolManager::noProxyFor();
+ QStringList noProxies = QStringList::split(QRegExp("[',''\t'' ']"), \
noProxiesFor); + bool useProxy = true;
+
+ // Host that libtunepimp will contact.
+ QString tunepimpHost = "www.musicbrainz.org";
+ QString tunepimpHostWithPort = "www.musicbrainz.org:80";
+
+ // Check what hosts are allowed to proceed without being proxied,
+ // or is using reversed proxy, what hosts must be proxied.
+ for(QStringList::ConstIterator it = noProxies.constBegin(); it != \
noProxies.constEnd(); ++it) { + QString normalizedHost = \
KNetwork::KResolver::normalizeDomain(*it); +
+ if(normalizedHost == tunepimpHost ||
+ tunepimpHost.endsWith("." + normalizedHost))
+ {
+ useProxy = false;
+ break;
+ }
+
+ // KDE's proxy mechanism also supports exempting a specific
+ // host/port combo, check that also.
+ if(normalizedHost == tunepimpHostWithPort ||
+ tunepimpHostWithPort.endsWith("." + normalizedHost))
+ {
+ useProxy = false;
+ break;
+ }
+ }
+
+ // KDE supports a reverse proxy mechanism. Uh, yay.
+ if(KProtocolManager::useReverseProxy())
+ useProxy = !useProxy;
+
+ if(useProxy) {
+ KURL proxy = KProtocolManager::proxyFor("http");
+ QString proxyHost = proxy.host();
+
+ kdDebug(65432) << "Using proxy server " << proxyHost << " for \
www.musicbrainz.org.\n"; + tp_SetProxy(m_pimp, proxyHost.latin1(), \
short(proxy.port())); + }
}
}
@@ -505,3 +550,5 @@
}
#endif
+
+// vim: set et ts=8 sw=4:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic