Summary: | MusicBrainz lookup in Amarok is missing support for proxy exceptions | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | N.Cat <trisk-bug> |
Component: | general | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.4.1 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | Patch for proxy exception support |
Description
N.Cat
2006-07-26 04:44:11 UTC
Created attachment 17129 [details] Patch for proxy exception support This is the patch that correctly fixes the problem, also available at http://trisk.acm.jhu.edu/ktrm-proxy-exception.diff SVN commit 567716 by aumuell: proxy exceptions for musicbrainz lookups BUG: 131377 M +2 -0 ChangeLog M +35 -2 src/ktrm.cpp --- trunk/extragear/multimedia/amarok/ChangeLog #567715:567716 @@ -68,6 +68,8 @@ since the last time it was enabled. BUGFIXES: + * Honour proxy exceptions for MusicBrainz lookups. Patch by N. Cat + <trisk-bug@quasarnet.org>. (BR 131377) * Correctly pass links containing parentheses to external browsers. Patch by Thomas Lindroth <tholi945@student.liu.se>. (BR 131307) * iPods would not show podcast descriptions. (BR 129824) --- trunk/extragear/multimedia/amarok/src/ktrm.cpp #567715:567716 @@ -28,6 +28,7 @@ #include <kapplication.h> #include <kprotocolmanager.h> #include <kurl.h> +#include <kresolver.h> #include <qmutex.h> #include <qevent.h> @@ -142,9 +143,41 @@ #endif tp_SetNotifyCallback(m_pimp, TRMNotifyCallback, 0); + KProtocolManager::reparseConfiguration(); + if(KProtocolManager::useProxy()) { - KURL proxy = KProtocolManager::proxyFor("http"); - tp_SetProxy(m_pimp, proxy.host().latin1(), short(proxy.port())); + QString noProxiesFor = KProtocolManager::noProxyFor(); + QStringList noProxies = QStringList::split(QRegExp("[',''\t'' ']"), noProxiesFor); + bool useProxy = true; + + char server[255]; + short port; + tp_GetServer(m_pimp, server, 255, &port); + QString tunepimpHost = QString(server); + QString tunepimpHostWithPort = (tunepimpHost + ":%1").arg(port); + + 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; + } + + if(normalizedHost == tunepimpHostWithPort || + tunepimpHostWithPort.endsWith("." + normalizedHost)) { + useProxy = false; + break; + } + } + + if(KProtocolManager::useReverseProxy()) + useProxy = !useProxy; + + if(useProxy) { + KURL proxy = KProtocolManager::proxyFor("http"); + tp_SetProxy(m_pimp, proxy.host().latin1(), short(proxy.port())); + } } } |