1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 03:10:12 +02:00

Add application proxy factory back in, only have servent use noproxy

in favor of default proxy, as opposed to when a SOCKS proxy is set
This commit is contained in:
Jeff Mitchell
2011-11-18 15:24:51 -05:00
parent 708668ea0a
commit 362f8fc622
3 changed files with 27 additions and 20 deletions

View File

@@ -18,18 +18,18 @@
#include "servent.h"
#include <QCoreApplication>
#include <QMutexLocker>
#include <QNetworkInterface>
#include <QFile>
#include <QThread>
#include <QNetworkProxy>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QtCore/QCoreApplication>
#include <QtCore/QMutexLocker>
#include <QtNetwork/QNetworkInterface>
#include <QtCore/QFile>
#include <QtCore/QThread>
#include <QtNetwork/QNetworkProxy>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply>
#ifndef ENABLE_HEADLESS
#include <QPushButton>
#include <QMessageBox>
#include <QtGui/QPushButton>
#include <QtGui/QMessageBox>
#endif
#include "result.h"
@@ -70,7 +70,9 @@ Servent::Servent( QObject* parent )
new ACLSystem( this );
setProxy( QNetworkProxy::NoProxy );
// Don't use system default proxy, so if SOCKS 5 specified, use that, otherwise set no proxy
if ( TomahawkSettings::instance()->proxyHost().isEmpty() )
setProxy( QNetworkProxy::NoProxy );
{
boost::function<QSharedPointer<QIODevice>(result_ptr)> fac =

View File

@@ -22,15 +22,15 @@
// time before new connection terminates if no auth received
#define AUTH_TIMEOUT 180000
#include <QObject>
#include <QTcpServer>
#include <QHostInfo>
#include <QMap>
#include <QMutex>
#include <QSharedPointer>
#include <QTcpSocket>
#include <QTimer>
#include <QPointer>
#include <QtCore/QObject>
#include <QtCore/QMap>
#include <QtCore/QMutex>
#include <QtCore/QSharedPointer>
#include <QtCore/QTimer>
#include <QtCore/QPointer>
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QTcpSocket>
#include <QtNetwork/QHostInfo>
#include <qjson/parser.h>
#include <qjson/serializer.h>

View File

@@ -487,8 +487,10 @@ NetworkProxyFactory::NetworkProxyFactory( const NetworkProxyFactory& other )
QList< QNetworkProxy >
NetworkProxyFactory::proxyForQuery( const QNetworkProxyQuery& query )
{
tDebug() << Q_FUNC_INFO;
TomahawkUtils::NetworkProxyFactory* proxyFactory = TomahawkUtils::proxyFactory();
QList< QNetworkProxy > proxies = proxyFactory->queryProxy( query );
tDebug() << Q_FUNC_INFO << " proxies size = " << proxies.size();
return proxies;
}
@@ -496,6 +498,7 @@ NetworkProxyFactory::proxyForQuery( const QNetworkProxyQuery& query )
QList< QNetworkProxy >
NetworkProxyFactory::queryProxy( const QNetworkProxyQuery& query )
{
tDebug() << Q_FUNC_INFO << "query.peerHostName() = " << query.peerHostName() << ", m_noProxyHosts = " << m_noProxyHosts;
QList< QNetworkProxy > proxies;
QString hostname = query.peerHostName();
if ( hostname.isEmpty() || m_noProxyHosts.contains( hostname ) )
@@ -503,6 +506,7 @@ NetworkProxyFactory::queryProxy( const QNetworkProxyQuery& query )
else
proxies << m_proxy << QNetworkProxy( QNetworkProxy::NoProxy ) << QNetworkProxy( QNetworkProxy::DefaultProxy );
tDebug() << Q_FUNC_INFO << " proxies size = " << proxies.size();
return proxies;
}
@@ -608,6 +612,7 @@ setProxyFactory( NetworkProxyFactory* factory, bool noMutexLocker )
*currFactory = *factory;
}
}
QNetworkProxyFactory::setApplicationProxyFactory( factory );
}
*s_threadProxyFactoryHash[ QThread::currentThread() ] = *factory;