From f125823b635fbc89308c5baf956fdb4d02a1a7e8 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 25 Aug 2007 10:19:31 +0000 Subject: added proxy support git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@127 90c681e8-e032-0410-971d-27865f9a5e38 --- lib/downloader.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/downloader.cpp') 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 #include +#include +#include #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(); -- cgit v1.2.3-13-gbd6f