summaryrefslogtreecommitdiff
path: root/client/netcom.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/netcom.cc')
-rw-r--r--client/netcom.cc34
1 files changed, 33 insertions, 1 deletions
diff --git a/client/netcom.cc b/client/netcom.cc
index 6150227..5cbcd22 100644
--- a/client/netcom.cc
+++ b/client/netcom.cc
@@ -26,6 +26,8 @@
*/
#include "netcom.h"
+#include <QtNetwork>
+
#include <QApplication>
#include <QByteArray>
@@ -33,13 +35,31 @@
#include "widgets/widget.h"
+#ifdef USE_SSL
+#include <QMessageBox>
+#include <QList>
+#include <QSslError>
+#include <QSslSocket>
+
+#ifdef QT_NO_OPENSSL
+#error "QT not compiled with SSL support."
+#endif
+#endif
+
NetCom::NetCom(QString host, quint16 port, QString user, QString cpr)
{
this->user = user;
this->cpr = cpr;
connect(&http, SIGNAL(done(bool)), this, SLOT(done(bool)));
- http.setHost(host, port);
+
+#ifdef USE_SSL
+ connect(&http, SIGNAL(sslErrors(const QList<QSslError> &)),
+ this, SLOT(sslError(const QList<QSslError> &)));
+ http.setHost(host, QHttp::ConnectionModeHttps, port);
+#else
+ http.setHost(host, QHttp::ConnectionModeHttp, port);
+#endif
transfering = false;
}
@@ -146,3 +166,15 @@ void NetCom::done(bool)
buffer = http.readAll();
transfering = false;
}
+
+#ifdef USE_SSL
+void NetCom::sslError(const QList<QSslError> &errlst)
+{
+ QList<QSslError>::const_iterator i = errlst.begin();
+ while(i != errlst.end()) {
+ QMessageBox::warning(qApp->activeWindow(), "SSL Error", i->errorString());
+ i++;
+ }
+ http.ignoreSslErrors();
+}
+#endif