diff --git a/src/downloadThread.cpp b/src/downloadThread.cpp index 65764b091..995506bd1 100644 --- a/src/downloadThread.cpp +++ b/src/downloadThread.cpp @@ -60,18 +60,20 @@ subDownloadThread::subDownloadThread(QObject *parent, QString url) : QThread(par // Proxy enabled QString IP = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString(); qDebug("Set proxy, hostname: %s, port: %d", IP.toUtf8().data(), settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toInt()); - if((intValue==1 || intValue==3) && !IP.startsWith("http://", Qt::CaseInsensitive)) { - // HTTP Proxy with missing leading http:// - url_stream->setProxy((QString("http://")+settings.value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString()).toUtf8().data(), settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toInt()); - }else { - url_stream->setProxy(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString().toUtf8().data(), settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toInt()); - } - if(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Authentication"), false).toBool()) { - qDebug("Proxy auth required"); - // Authentication required - url_stream->setProxyUser(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Username"), QString()).toString().toUtf8().data()); - url_stream->setProxyPassword(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Password"), QString()).toString().toUtf8().data()); - } + if(intValue==1 || intValue==3) { + if(!IP.startsWith("http://", Qt::CaseInsensitive)) { + // HTTP Proxy without leading http:// + url_stream->setProxy((QString("http://")+settings.value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString()).toUtf8().data(), settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toInt()); + }else { + url_stream->setProxy(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString().toUtf8().data(), settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toInt()); + } + if(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Authentication"), false).toBool()) { + qDebug("Proxy auth required"); + // Authentication required + url_stream->setProxyUser(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Username"), QString()).toString().toUtf8().data()); + url_stream->setProxyPassword(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Password"), QString()).toString().toUtf8().data()); + } + } //TODO: Support SOCKS5 proxies } }