From ceb2bcca7e4fd1dd90a5e641ecc2a5c49992cb9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Mon, 29 Jun 2009 09:46:46 +0000 Subject: [PATCH] new options for SwissSurfer --- proxyface/autoproxy.hxx | 30 +++++++++++++++++++++++++++--- proxyface/proxy.hxx | 18 +++++++++++++++--- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/proxyface/autoproxy.hxx b/proxyface/autoproxy.hxx index f4feaff..fc7824e 100644 --- a/proxyface/autoproxy.hxx +++ b/proxyface/autoproxy.hxx @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -79,7 +80,7 @@ namespace proxy { #endif { #ifdef QT_NETWORK_LIB - Q_OBJECT; + Q_OBJECT #endif public: //! Keep your instance as long as possible, because of caching. @@ -169,8 +170,19 @@ namespace proxy { QNetworkAccessManager* manager(new QNetworkAccessManager); manager->setProxy(prxy); if (!connect(manager, SIGNAL(finished(QNetworkReply*)), - this, SLOT(replyFinished(QNetworkReply*)))) + SLOT(replyFinished(QNetworkReply*)))) qFatal("connect failed"); + connect(manager, + SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*))); + connect(manager, + SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, + QAuthenticator*)), + SLOT(proxyAuthenticationRequired(const QNetworkProxy&, + QAuthenticator*))); + connect(manager, + SIGNAL(sslErrors(QNetworkReply*, const QList&)), + SLOT(sslErrors(QNetworkReply*, const QList&))); _requests.insert (std::make_pair(manager->head (QNetworkRequest @@ -220,13 +232,25 @@ namespace proxy { _timeout2.stop(); QNetworkProxy prxy(_requests[reply].second); QUrl url(reply->url()); - for (Requests::iterator it(_requests.begin()); it!=_requests.end(); ++it) + for (Requests::iterator it(_requests.begin()); + it!=_requests.end(); ++it) delete it->second.first; _requests.clear(); qDebug()<<"SUCCESS - Valid proxy found for url:" <<"url="<& l) { + qDebug()<<"## "<<__PRETTY_FUNCTION__; + for (QList::const_iterator it(l.begin()); it!=l.end(); ++it) + qDebug()<<" SSL-Error -> "<errorString(); + } private: typedef std::map > diff --git a/proxyface/proxy.hxx b/proxyface/proxy.hxx index 49349f5..73aa9d6 100644 --- a/proxyface/proxy.hxx +++ b/proxyface/proxy.hxx @@ -31,11 +31,18 @@ class Proxy: public QDialog, public Ui::Proxy { _url->setText(s.value("default-server", QString()).toString()); _port->setValue(s.value("default-port", 0).toInt()); connect(&_auto, SIGNAL(proxyFound(const QUrl&, const QNetworkProxy&)), - SLOT(proxyFound(const QUrl&, const QNetworkProxy&))); + SIGNAL(proxyFound(const QUrl&, const QNetworkProxy&))); + connect(&_auto, SIGNAL(proxyFound(const QUrl&, const QNetworkProxy&)), + SLOT(proxyFoundSlot(const QUrl&, const QNetworkProxy&))); + connect(&_auto, SIGNAL(proxyError(QNetworkReply::NetworkError)), + SIGNAL(proxyError(QNetworkReply::NetworkError))); accept(); } - public: + void checkUrl(const QString& url) { + _testUrl = url; + accept(); + } void acceptValues() { QNetworkProxy::ProxyType type(QNetworkProxy::NoProxy); @@ -72,9 +79,14 @@ class Proxy: public QDialog, public Ui::Proxy { .arg(QNetworkProxy::applicationProxy().port())); } + Q_SIGNALS: + + void proxyFound(const QUrl&, const QNetworkProxy&); + void proxyError(QNetworkReply::NetworkError); + public Q_SLOTS: - void proxyFound(const QUrl&, const QNetworkProxy& p) { + void proxyFoundSlot(const QUrl&, const QNetworkProxy& p) { QNetworkProxy::setApplicationProxy(p); _url->setText(p.hostName()); _port->setValue(p.port());