Set some SSL parameters for network request.
[toast/confclerk.git] / src / gui / mainwindow.cpp
index 31ac95d..a2e28d1 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 Ixonos Plc.
- * Copyright (C) 2011-2015 Philipp Spitzer, gregor herrmann, Stefan Stahl
+ * Copyright (C) 2011-2017 Philipp Spitzer, gregor herrmann, Stefan Stahl
  *
  * This file is part of ConfClerk.
  *
@@ -24,6 +24,7 @@
 #include <QNetworkProxy>
 #include <QNetworkAccessManager>
 #include <QNetworkReply>
+#include <QSslConfiguration>
 
 #include "sqlengine.h"
 
@@ -410,7 +411,7 @@ void MainWindow::on_conferencesAction_triggered()
 
 void MainWindow::networkQueryFinished(QNetworkReply *aReply) {
     if (aReply->error() != QNetworkReply::NoError) {
-        error_message(QString("Error occured during download: ") + aReply->errorString());
+        error_message(QString("Error occurred during download: ") + aReply->errorString());
     } else {
         QUrl redirectUrl = aReply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
         if (!redirectUrl.isEmpty()) {
@@ -435,7 +436,11 @@ void MainWindow::importData(const QByteArray &aData, const QString& url, int con
 void MainWindow::importFromNetwork(const QString& url, int conferenceId)
 {
     QNetworkRequest request;
+    QSslConfiguration qSslConfiguration = request.sslConfiguration();
+    qSslConfiguration.setProtocol(QSsl::AnyProtocol);
+    qSslConfiguration.setPeerVerifyMode(QSslSocket::QueryPeer);
     request.setUrl(QUrl(url));
+    request.setSslConfiguration(qSslConfiguration);
     request.setAttribute(QNetworkRequest::User, conferenceId);
 
     mNetworkAccessManager->setProxy(QNetworkProxy::applicationProxy());