aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2007-08-25 10:19:31 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2007-08-25 10:19:31 +0000
commitf125823b635fbc89308c5baf956fdb4d02a1a7e8 (patch)
treea75eca80c43dfe826beb9c8ae8316141bdd40ad4 /lib
parente6223d1c69fbf1484f7fa29dd5f41da03e0313d4 (diff)
downloadqmmp-f125823b635fbc89308c5baf956fdb4d02a1a7e8.tar.gz
qmmp-f125823b635fbc89308c5baf956fdb4d02a1a7e8.tar.bz2
qmmp-f125823b635fbc89308c5baf956fdb4d02a1a7e8.zip
added proxy support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@127 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'lib')
-rw-r--r--lib/downloader.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/downloader.cpp b/lib/downloader.cpp
index e025e4f52..b202b4436 100644
--- a/lib/downloader.cpp
+++ b/lib/downloader.cpp
@@ -20,6 +20,8 @@
#include <QApplication>
#include <QStringList>
+#include <QSettings>
+#include <QDir>
#include "downloader.h"
@@ -195,6 +197,21 @@ void Downloader::run()
{
qDebug("Downloader: starting download thread");
m_handle = curl_easy_init();
+
+ //proxy
+ QSettings settings ( QDir::homePath() +"/.qmmp/qmmprc", QSettings::IniFormat );
+ if (settings.value ("Proxy/use_proxy", FALSE).toBool())
+ curl_easy_setopt(m_handle, CURLOPT_PROXY,
+ (settings.value("Proxy/host").toString()+":"+
+ settings.value("Proxy/port").toString()).
+ toLatin1 ().constData ());
+
+ if (settings.value ("Proxy/authentication", FALSE).toBool())
+ curl_easy_setopt(m_handle, CURLOPT_PROXYUSERPWD,
+ (settings.value("Proxy/user").toString()+":"+
+ settings.value("Proxy/passw").toString()).
+ toLatin1 ().constData ());
+
// Set url to download
curl_easy_setopt(m_handle, CURLOPT_URL, m_url.toAscii().constData());
//qDebug("Downloader: url: %s", qPrintable(url));
@@ -276,7 +293,7 @@ void Downloader::readICYMetaData()
{
int size = packet_size * 16;
char packet[size];
- while(m_stream.buf_fill < size && isRunning())
+ while (m_stream.buf_fill < size && isRunning())
{
m_mutex.unlock();
qApp->processEvents();