mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
parent
6a1744e29d
commit
e79467b626
1 changed files with 32 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
#include <QtNetwork/QNetworkProxy>
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
@ -350,6 +351,37 @@ void DownloadThread::run()
|
||||||
|
|
||||||
if (!_useragent.isEmpty())
|
if (!_useragent.isEmpty())
|
||||||
curl_easy_setopt(_c, CURLOPT_USERAGENT, _useragent.constData());
|
curl_easy_setopt(_c, CURLOPT_USERAGENT, _useragent.constData());
|
||||||
|
|
||||||
|
if (_proxy.isEmpty())
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_NETWORKPROXY
|
||||||
|
/* Ask OS for proxy information. */
|
||||||
|
QNetworkProxyQuery npq{QUrl{_url}};
|
||||||
|
QList<QNetworkProxy> proxyList = QNetworkProxyFactory::systemProxyForQuery(npq);
|
||||||
|
if (!proxyList.isEmpty())
|
||||||
|
{
|
||||||
|
QNetworkProxy proxy = proxyList.first();
|
||||||
|
if (proxy.type() != proxy.NoProxy)
|
||||||
|
{
|
||||||
|
QUrl proxyUrl;
|
||||||
|
|
||||||
|
proxyUrl.setScheme(proxy.type() == proxy.Socks5Proxy ? "socks5h" : "http");
|
||||||
|
proxyUrl.setHost(proxy.hostName());
|
||||||
|
proxyUrl.setPort(proxy.port());
|
||||||
|
qDebug() << "Using proxy server:" << proxyUrl;
|
||||||
|
|
||||||
|
if (!proxy.user().isEmpty())
|
||||||
|
{
|
||||||
|
proxyUrl.setUserName(proxy.user());
|
||||||
|
proxyUrl.setPassword(proxy.password());
|
||||||
|
}
|
||||||
|
|
||||||
|
_proxy = proxyUrl.toEncoded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (!_proxy.isEmpty())
|
if (!_proxy.isEmpty())
|
||||||
curl_easy_setopt(_c, CURLOPT_PROXY, _proxy.constData());
|
curl_easy_setopt(_c, CURLOPT_PROXY, _proxy.constData());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue