Skip to content

Commit

Permalink
Use Qt5 non-OpenSSL define in testing for SSL support
Browse files Browse the repository at this point in the history
  • Loading branch information
dakcarto committed Nov 20, 2016
1 parent 9679b6a commit 4c2725b
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 30 deletions.
8 changes: 4 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -54,7 +54,7 @@
#include <QShortcut>
#include <QSpinBox>
#include <QSplashScreen>
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QSslConfiguration>
#endif
#include <QStatusBar>
Expand Down Expand Up @@ -110,7 +110,7 @@
#include "qgsattributedialog.h"
#include "qgsauthmanager.h"
#include "qgsauthguiutils.h"
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include "qgsauthcertutils.h"
#include "qgsauthsslerrorsdialog.h"
#endif
Expand Down Expand Up @@ -11521,7 +11521,7 @@ void QgisApp::namSetup()
connect( nam, SIGNAL( requestTimedOut( QNetworkReply* ) ),
this, SLOT( namRequestTimedOut( QNetworkReply* ) ) );

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
connect( nam, SIGNAL( sslErrors( QNetworkReply *, const QList<QSslError> & ) ),
this, SLOT( namSslErrors( QNetworkReply *, const QList<QSslError> & ) ) );
#endif
Expand Down Expand Up @@ -11643,7 +11643,7 @@ void QgisApp::namProxyAuthenticationRequired( const QNetworkProxy &proxy, QAuthe
auth->setPassword( password );
}

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
void QgisApp::namSslErrors( QNetworkReply *reply, const QList<QSslError> &errors )
{
// stop the timeout timer, or app crashes if the user (or slot) takes longer than
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Expand Up @@ -674,7 +674,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! request credentials for network manager
void namAuthenticationRequired( QNetworkReply *reply, QAuthenticator *auth );
void namProxyAuthenticationRequired( const QNetworkProxy &proxy, QAuthenticator *auth );
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
void namSslErrors( QNetworkReply *reply, const QList<QSslError> &errors );
#endif
void namRequestTimedOut( QNetworkReply *reply );
Expand Down
2 changes: 1 addition & 1 deletion src/auth/identcert/qgsauthidentcertmethod.cpp
Expand Up @@ -20,7 +20,7 @@
#include <QDir>
#include <QFile>
#include <QUuid>
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QtCrypto>
#include <QSslConfiguration>
#include <QSslError>
Expand Down
2 changes: 1 addition & 1 deletion src/auth/pkipaths/qgsauthpkipathsmethod.cpp
Expand Up @@ -20,7 +20,7 @@
#include <QDir>
#include <QFile>
#include <QUuid>
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QtCrypto>
#include <QSslConfiguration>
#include <QSslError>
Expand Down
2 changes: 1 addition & 1 deletion src/auth/pkipkcs12/qgsauthpkcs12method.cpp
Expand Up @@ -20,7 +20,7 @@
#include <QDir>
#include <QFile>
#include <QUuid>
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QtCrypto>
#include <QSslConfiguration>
#include <QSslError>
Expand Down
2 changes: 1 addition & 1 deletion src/core/auth/qgsauthconfig.cpp
Expand Up @@ -156,7 +156,7 @@ bool QgsAuthMethodConfig::uriToResource( const QString &accessurl, QString *reso
}


#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL

//////////////////////////////////////////////////////
// QgsPkiBundle
Expand Down
4 changes: 2 additions & 2 deletions src/core/auth/qgsauthconfig.h
Expand Up @@ -20,7 +20,7 @@
#include <QHash>
#include <QString>

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QSslCertificate>
#include <QSslKey>
#include <QSslError>
Expand Down Expand Up @@ -177,7 +177,7 @@ class CORE_EXPORT QgsAuthMethodConfig
typedef QHash<QString, QgsAuthMethodConfig> QgsAuthMethodConfigsMap;


#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL

/** \ingroup core
* \brief Storage set for PKI bundle: SSL certificate, key, optional CA cert chain
Expand Down
8 changes: 4 additions & 4 deletions src/core/auth/qgsauthmanager.cpp
Expand Up @@ -33,7 +33,7 @@

#include <QtCrypto>

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QSslConfiguration>
#endif

Expand Down Expand Up @@ -197,7 +197,7 @@ bool QgsAuthManager::init( const QString& pluginPath )

updateConfigAuthMethods();

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
initSslCaches();
#endif

Expand Down Expand Up @@ -258,7 +258,7 @@ bool QgsAuthManager::init( const QString& pluginPath )
return false;
}

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
initSslCaches();
#endif

Expand Down Expand Up @@ -1572,7 +1572,7 @@ bool QgsAuthManager::removeAuthSetting( const QString& key )
}


#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL

////////////////// Certificate calls ///////////////////////

Expand Down
8 changes: 4 additions & 4 deletions src/core/auth/qgsauthmanager.h
Expand Up @@ -26,7 +26,7 @@
#include <QSqlQuery>
#include <QStringList>

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QSslCertificate>
#include <QSslKey>
#include <QtCrypto>
Expand Down Expand Up @@ -339,7 +339,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
//! Remove an authentication setting
bool removeAuthSetting( const QString& key );

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
////////////////// Certificate calls ///////////////////////

//! Initialize various SSL authentication caches
Expand Down Expand Up @@ -581,7 +581,7 @@ class CORE_EXPORT QgsAuthManager : public QObject

bool authDbTransactionQuery( QSqlQuery *query ) const;

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
void insertCaCertInCache( QgsAuthCertUtils::CaCertSource source, const QList<QSslCertificate> &certs );
#endif

Expand Down Expand Up @@ -625,7 +625,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
int mScheduledDbEraseRequestCount;
QMutex *mMutex;

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
// mapping of sha1 digest and cert source and cert
// appending removes duplicates
QMap<QString, QPair<QgsAuthCertUtils::CaCertSource , QSslCertificate> > mCaCertsCache;
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsnetworkaccessmanager.cpp
Expand Up @@ -32,7 +32,7 @@
#include <QNetworkReply>
#include <QThreadStorage>

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QSslConfiguration>
#endif

Expand Down Expand Up @@ -182,7 +182,7 @@ QNetworkReply *QgsNetworkAccessManager::createRequest( QNetworkAccessManager::Op
userAgent += QStringLiteral( "QGIS/%1" ).arg( Qgis::QGIS_VERSION );
pReq->setRawHeader( "User-Agent", userAgent.toUtf8() );

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
bool ishttps = pReq->url().scheme().toLower() == QLatin1String( "https" );
if ( ishttps && !QgsAuthManager::instance()->isDisabled() )
{
Expand Down Expand Up @@ -305,7 +305,7 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache()
connect( this, SIGNAL( requestTimedOut( QNetworkReply* ) ),
smMainNAM, SIGNAL( requestTimedOut( QNetworkReply* ) ) );

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
connect( this, SIGNAL( sslErrors( QNetworkReply *, const QList<QSslError> & ) ),
smMainNAM, SIGNAL( sslErrors( QNetworkReply *, const QList<QSslError> & ) ),
Qt::BlockingQueuedConnection );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/auth/qgsauthcertificateinfo.h
Expand Up @@ -20,7 +20,7 @@

#include <QFile>

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QtCrypto>
#include <QSslCertificate>
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsfiledownloader.cpp
Expand Up @@ -20,7 +20,7 @@
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QMessageBox>
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QSslError>
#endif

Expand Down Expand Up @@ -64,7 +64,7 @@ void QgsFileDownloader::startDownload()
connect( mReply, &QNetworkReply::finished, this, &QgsFileDownloader::onFinished );
connect( mReply, &QNetworkReply::downloadProgress, this, &QgsFileDownloader::onDownloadProgress );
connect( nam, &QgsNetworkAccessManager::requestTimedOut, this, &QgsFileDownloader::onRequestTimedOut );
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
connect( nam, &QgsNetworkAccessManager::sslErrors, this, &QgsFileDownloader::onSslErrors );
#endif
if ( mGuiNotificationsEnabled )
Expand All @@ -89,7 +89,7 @@ void QgsFileDownloader::onRequestTimedOut()
error( tr( "Network request %1 timed out" ).arg( mUrl.toString() ) );
}

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
void QgsFileDownloader::onSslErrors( QNetworkReply *reply, const QList<QSslError> &errors )
{
Q_UNUSED( reply );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsfiledownloader.h
Expand Up @@ -20,7 +20,7 @@
#include <QFile>
#include <QNetworkReply>
#include <QProgressDialog>
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QSslError>
#endif

Expand Down Expand Up @@ -87,7 +87,7 @@ class GUI_EXPORT QgsFileDownloader : public QObject
void onRequestTimedOut();
//! Called to start the download
void startDownload();
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL

/**
* Called on SSL network Errors
Expand Down
4 changes: 2 additions & 2 deletions tests/src/gui/testqgsfiledownloader.cpp
Expand Up @@ -82,7 +82,7 @@ class TestQgsFileDownloader: public QObject
void testInvalidFile();
void testInvalidUrl();
void testBlankUrl();
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
void testSslError_data();
void testSslError();
#endif
Expand Down Expand Up @@ -219,7 +219,7 @@ void TestQgsFileDownloader::testBlankUrl()
QCOMPARE( mErrorMessage, QString( "Network error 301: Protocol \"\" is unknown" ) );
}

#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
void TestQgsFileDownloader::testSslError_data()
{
QTest::addColumn<QString>( "url" );
Expand Down

0 comments on commit 4c2725b

Please sign in to comment.