diff options
author | Jonathan Bauer | 2012-06-22 15:33:29 +0200 |
---|---|---|
committer | Jonathan Bauer | 2012-06-22 15:33:29 +0200 |
commit | 4658fb5f8450f0058ba568b5952d53d58ffbce8a (patch) | |
tree | 280ad6fe3bf325027ecd6798c521317cfbcefd63 /src/fbgui | |
parent | renamed build-pkg.sh to pkg.sh (diff) | |
download | fbgui-4658fb5f8450f0058ba568b5952d53d58ffbce8a.tar.gz fbgui-4658fb5f8450f0058ba568b5952d53d58ffbce8a.tar.xz fbgui-4658fb5f8450f0058ba568b5952d53d58ffbce8a.zip |
workaround to load ssl sites (todo proper error handling)
Diffstat (limited to 'src/fbgui')
-rw-r--r-- | src/fbgui/fbgui.cpp | 15 | ||||
-rw-r--r-- | src/fbgui/fbgui.h | 1 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp index 2881a30..0fd61be 100644 --- a/src/fbgui/fbgui.cpp +++ b/src/fbgui/fbgui.cpp @@ -126,6 +126,9 @@ void fbgui::loadURL() { QByteArray postData = generatePOSTData(); // Generate a Network Request Object QNetworkRequest req(baseURL); + QObject::connect(_webView->page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> & )), + this, SLOT(sslErrorHandler(QNetworkReply*, QList<QSslError> ))); + // show cursor again since user is about to interact. req.setHeader(QNetworkRequest::ContentTypeHeader, @@ -135,7 +138,15 @@ void fbgui::loadURL() { } // TODO: error page if no host. } - +void fbgui::sslErrorHandler(QNetworkReply* rep, QList<QSslError> errList) { + LOG4CXX_DEBUG(coreLogger, "Received SSL errors:"); + rep->ignoreSslErrors(errList); + QList<QSslError>::iterator n; + for (n = errList.begin(); n != errList.end(); ++n) { + LOG4CXX_DEBUG(coreLogger, "Error :" << n->errorString()); + } + LOG4CXX_DEBUG(coreLogger, "End SSL errors:"); +} void fbgui::loadURLDone(bool success) { // done contains the success of the loading: false / true if (!success) { @@ -275,7 +286,7 @@ QByteArray fbgui::generatePOSTData() { // everything ok, read data serial = file.readAll(); file.close(); - serial.chop(1); // chop EOF + //serial.chop(1); // chop EOF LOG4CXX_DEBUG(coreLogger, "[post] Serial number is: " << serial); if (gInterfaceName.isEmpty()) diff --git a/src/fbgui/fbgui.h b/src/fbgui/fbgui.h index 3eb4bcd..07b69f4 100644 --- a/src/fbgui/fbgui.h +++ b/src/fbgui/fbgui.h @@ -48,6 +48,7 @@ private: private slots: void loadURLDone(bool success); + void sslErrorHandler(QNetworkReply* rep, QList<QSslError> errList); void clearAllCookies(); void printCookies(); void printHistory(); |