|
|
@ -15,7 +15,9 @@ |
|
|
|
#include <QtNetwork/QSslError> |
|
|
|
#include <QtNetwork/QSslError> |
|
|
|
#include <QtCore/QTimer> |
|
|
|
#include <QtCore/QTimer> |
|
|
|
#include <QtCore/QDebug> |
|
|
|
#include <QtCore/QDebug> |
|
|
|
|
|
|
|
#ifndef Q_OS_WIN32 |
|
|
|
#include <QtCore/QThread> |
|
|
|
#include <QtCore/QThread> |
|
|
|
|
|
|
|
#endif |
|
|
|
#include <map> |
|
|
|
#include <map> |
|
|
|
#ifndef PROXYFACE_LOG |
|
|
|
#ifndef PROXYFACE_LOG |
|
|
|
#define PROXYFACE_LOG qDebug()<<__PRETTY_FUNCTION__ |
|
|
|
#define PROXYFACE_LOG qDebug()<<__PRETTY_FUNCTION__ |
|
|
@ -80,7 +82,11 @@ namespace proxy { |
|
|
|
@example test.cxx */ |
|
|
|
@example test.cxx */ |
|
|
|
class Interface |
|
|
|
class Interface |
|
|
|
#ifdef QT_NETWORK_LIB |
|
|
|
#ifdef QT_NETWORK_LIB |
|
|
|
|
|
|
|
#ifdef Q_OS_WIN32 |
|
|
|
|
|
|
|
: public QObject |
|
|
|
|
|
|
|
#else |
|
|
|
: public QThread |
|
|
|
: public QThread |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
{ |
|
|
|
{ |
|
|
|
#ifdef QT_NETWORK_LIB |
|
|
|
#ifdef QT_NETWORK_LIB |
|
|
@ -95,8 +101,10 @@ namespace proxy { |
|
|
|
qFatal("connect failed"); |
|
|
|
qFatal("connect failed"); |
|
|
|
if (!connect(&_timeout2, SIGNAL(timeout()), SLOT(timeout()))) |
|
|
|
if (!connect(&_timeout2, SIGNAL(timeout()), SLOT(timeout()))) |
|
|
|
qFatal("connect failed"); |
|
|
|
qFatal("connect failed"); |
|
|
|
|
|
|
|
#ifndef Q_OS_WIN32 |
|
|
|
if (!connect(this, SIGNAL(finished()), SLOT(threadFinished()))) |
|
|
|
if (!connect(this, SIGNAL(finished()), SLOT(threadFinished()))) |
|
|
|
qFatal("connect failed"); |
|
|
|
qFatal("connect failed"); |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
virtual ~Interface() {} |
|
|
|
virtual ~Interface() {} |
|
|
@ -245,7 +253,11 @@ namespace proxy { |
|
|
|
" try autoproxy negotiation"; |
|
|
|
" try autoproxy negotiation"; |
|
|
|
_direct = false; |
|
|
|
_direct = false; |
|
|
|
_url = url; |
|
|
|
_url = url; |
|
|
|
|
|
|
|
#ifndef Q_OS_WIN32 |
|
|
|
start(); // autoproxy detection in own thread
|
|
|
|
start(); // autoproxy detection in own thread
|
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
run(); |
|
|
|
|
|
|
|
#endif |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
qDebug()<<"No proxy at all, giving up - offline?"; |
|
|
|
qDebug()<<"No proxy at all, giving up - offline?"; |
|
|
|
proxyError(QNetworkReply::TimeoutError); |
|
|
|
proxyError(QNetworkReply::TimeoutError); |
|
|
@ -307,6 +319,9 @@ namespace proxy { |
|
|
|
void run() { |
|
|
|
void run() { |
|
|
|
PROXYFACE_LOG; |
|
|
|
PROXYFACE_LOG; |
|
|
|
_proxies = proxies(_url); |
|
|
|
_proxies = proxies(_url); |
|
|
|
|
|
|
|
#ifdef Q_OS_WIN32 |
|
|
|
|
|
|
|
threadFinished(); |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
private: |
|
|
|
private: |
|
|
|
typedef std::map |
|
|
|
typedef std::map |
|
|
|