summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Chu <ryan.chu@qt.io>2018-08-21 14:03:59 +0200
committerRyan Chu <ryan.chu@qt.io>2018-08-22 10:15:52 +0000
commit4fd2176252d671d5a4b8f46eb2cbabdf2b78de46 (patch)
tree7aba0ad5a048bb32e0d2fe8083f1ad638934993c
parent4fc73da284598045e178c5ab2e1f96b9626abbcd (diff)
Fix build error when SSL configuration is disabled
When QT_NO_SSL is used, the value of QT_FEATURE_ssl is also defined to '-1' in qtnetwork-config.h. The "#if defined(QT_FEATURE_ssl)" block will be compiled, and then it implies that 'QSslSocket' was not declared in this scope. The QT_CONFIG macro implements a compile-time check for features of Qt. If QT_FEATURE_ssl is '0' or undefined, QT_ CONFIG(ssl) will lead to a compile error. If QT_FEATURE_ssl is '-1' (unavailable), the constant-expression of QT_ CONFIG(ssl) will be false. Change-Id: I80bef731e8246f9206601527435a43195989331b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
-rw-r--r--src/httpserver/qhttpserverrequest.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/httpserver/qhttpserverrequest.cpp b/src/httpserver/qhttpserverrequest.cpp
index 41f4cf2..07f89a4 100644
--- a/src/httpserver/qhttpserverrequest.cpp
+++ b/src/httpserver/qhttpserverrequest.cpp
@@ -44,7 +44,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qloggingcategory.h>
#include <QtNetwork/qtcpsocket.h>
-#if defined(QT_FEATURE_ssl)
+#if QT_CONFIG(ssl)
#include <QtNetwork/qsslsocket.h>
#endif
@@ -102,7 +102,7 @@ bool QHttpServerRequestPrivate::parse(QIODevice *socket)
{
const auto fragment = socket->readAll();
if (fragment.size()) {
-#if defined(QT_FEATURE_ssl)
+#if QT_CONFIG(ssl)
auto sslSocket = qobject_cast<QSslSocket *>(socket);
url.setScheme(sslSocket && sslSocket->isEncrypted() ? QStringLiteral("https")
: QStringLiteral("http"));