Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Modernize use of 'http' feature
Exclude QHttp(Multi)Part from being built if http is disabled, and
replace the exclusion macros. Use the qmake project files to exclude
source files, and QT_REQUIRE_CONFIG(http) in headers.

Task-number: QTBUG-66606
Change-Id: I432fa3c78aa97b5ed2eb1027ac1dc3bdb134f9ba
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
(cherry picked from commit 1a0b4b9f26e16532cc3d5532e25d886426ce994e)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
  • Loading branch information
Ulf Hermann authored and Passeli committed Mar 1, 2018
1 parent 4495a4d commit eaa6eb5
Show file tree
Hide file tree
Showing 33 changed files with 101 additions and 126 deletions.
59 changes: 33 additions & 26 deletions src/network/access/access.pri
@@ -1,14 +1,6 @@
# Qt network access module

HEADERS += \
access/qhttpnetworkheader_p.h \
access/qhttpnetworkrequest_p.h \
access/qhttpnetworkreply_p.h \
access/qhttpnetworkconnection_p.h \
access/qhttpnetworkconnectionchannel_p.h \
access/qabstractprotocolhandler_p.h \
access/qhttpprotocolhandler_p.h \
access/qspdyprotocolhandler_p.h \
access/qnetworkaccessauthenticationmanager_p.h \
access/qnetworkaccessmanager.h \
access/qnetworkaccessmanager_p.h \
Expand All @@ -27,27 +19,14 @@ HEADERS += \
access/qnetworkreply_p.h \
access/qnetworkreplyimpl_p.h \
access/qnetworkreplydataimpl_p.h \
access/qnetworkreplyhttpimpl_p.h \
access/qnetworkreplyfileimpl_p.h \
access/qabstractnetworkcache_p.h \
access/qabstractnetworkcache.h \
access/qhttpthreaddelegate_p.h \
access/qhttpmultipart.h \
access/qhttpmultipart_p.h \
access/qnetworkfile_p.h \
access/qhttp2protocolhandler_p.h \
access/qhsts_p.h \
access/qhstspolicy.h

SOURCES += \
access/qhttpnetworkheader.cpp \
access/qhttpnetworkrequest.cpp \
access/qhttpnetworkreply.cpp \
access/qhttpnetworkconnection.cpp \
access/qhttpnetworkconnectionchannel.cpp \
access/qabstractprotocolhandler.cpp \
access/qhttpprotocolhandler.cpp \
access/qspdyprotocolhandler.cpp \
access/qnetworkaccessauthenticationmanager.cpp \
access/qnetworkaccessmanager.cpp \
access/qnetworkaccesscache.cpp \
Expand All @@ -61,13 +40,9 @@ SOURCES += \
access/qnetworkreply.cpp \
access/qnetworkreplyimpl.cpp \
access/qnetworkreplydataimpl.cpp \
access/qnetworkreplyhttpimpl.cpp \
access/qnetworkreplyfileimpl.cpp \
access/qabstractnetworkcache.cpp \
access/qhttpthreaddelegate.cpp \
access/qhttpmultipart.cpp \
access/qnetworkfile.cpp \
access/qhttp2protocolhandler.cpp \
access/qhsts.cpp \
access/qhstspolicy.cpp

Expand All @@ -92,4 +67,36 @@ qtConfig(networkdiskcache) {
mac: LIBS_PRIVATE += -framework Security

include($$PWD/../../3rdparty/zlib_dependency.pri)
include($$PWD/http2/http2.pri)

qtConfig(http) {
include($$PWD/http2/http2.pri)

SOURCES += \
access/qabstractprotocolhandler.cpp \
access/qhttp2protocolhandler.cpp \
access/qhttpmultipart.cpp \
access/qhttpnetworkconnection.cpp \
access/qhttpnetworkconnectionchannel.cpp \
access/qhttpnetworkheader.cpp \
access/qhttpnetworkreply.cpp \
access/qhttpnetworkrequest.cpp \
access/qhttpprotocolhandler.cpp \
access/qhttpthreaddelegate.cpp \
access/qnetworkreplyhttpimpl.cpp \
access/qspdyprotocolhandler.cpp

HEADERS += \
access/qabstractprotocolhandler_p.h \
access/qhttp2protocolhandler_p.h \
access/qhttpmultipart.h \
access/qhttpmultipart_p.h \
access/qhttpnetworkconnection_p.h \
access/qhttpnetworkconnectionchannel_p.h \
access/qhttpnetworkheader_p.h \
access/qhttpnetworkreply_p.h \
access/qhttpnetworkrequest_p.h \
access/qhttpprotocolhandler_p.h \
access/qhttpthreaddelegate_p.h \
access/qnetworkreplyhttpimpl_p.h \
access/qspdyprotocolhandler_p.h
}
2 changes: 2 additions & 0 deletions src/network/access/http2/http2streams_p.h
Expand Up @@ -62,6 +62,8 @@

#include <vector>

QT_REQUIRE_CONFIG(http);

QT_BEGIN_NAMESPACE

class QNonContiguousByteDevice;
Expand Down
4 changes: 0 additions & 4 deletions src/network/access/qabstractprotocolhandler.cpp
Expand Up @@ -40,8 +40,6 @@
#include <private/qabstractprotocolhandler_p.h>
#include <private/qhttpnetworkconnectionchannel_p.h>

#ifndef QT_NO_HTTP

QT_BEGIN_NAMESPACE

QAbstractProtocolHandler::QAbstractProtocolHandler(QHttpNetworkConnectionChannel *channel)
Expand All @@ -62,5 +60,3 @@ void QAbstractProtocolHandler::setReply(QHttpNetworkReply *reply)
}

QT_END_NAMESPACE

#endif // QT_NO_HTTP
4 changes: 1 addition & 3 deletions src/network/access/qabstractprotocolhandler_p.h
Expand Up @@ -53,7 +53,7 @@

#include <QtNetwork/private/qtnetworkglobal_p.h>

#ifndef QT_NO_HTTP
QT_REQUIRE_CONFIG(http);

QT_BEGIN_NAMESPACE

Expand Down Expand Up @@ -81,6 +81,4 @@ class QAbstractProtocolHandler {

QT_END_NAMESPACE

#endif // QT_NO_HTTP

#endif // QABSTRACTPROTOCOLHANDLER_H
4 changes: 0 additions & 4 deletions src/network/access/qhttp2protocolhandler.cpp
Expand Up @@ -40,8 +40,6 @@
#include "qhttpnetworkconnection_p.h"
#include "qhttp2protocolhandler_p.h"

#if !defined(QT_NO_HTTP)

#include "http2/bitstreams_p.h"

#include <private/qnoncontiguousbytedevice_p.h>
Expand Down Expand Up @@ -1475,5 +1473,3 @@ void QHttp2ProtocolHandler::closeSession()
}

QT_END_NAMESPACE

#endif // !defined(QT_NO_HTTP)
6 changes: 2 additions & 4 deletions src/network/access/qhttp2protocolhandler_p.h
Expand Up @@ -55,8 +55,6 @@
#include <private/qabstractprotocolhandler_p.h>
#include <private/qhttpnetworkrequest_p.h>

#if !defined(QT_NO_HTTP)

#include <private/http2protocol_p.h>
#include <private/http2streams_p.h>
#include <private/http2frames_p.h>
Expand All @@ -75,6 +73,8 @@
#include <deque>
#include <set>

QT_REQUIRE_CONFIG(http);

QT_BEGIN_NAMESPACE

class QHttp2ProtocolHandler : public QObject, public QAbstractProtocolHandler
Expand Down Expand Up @@ -214,6 +214,4 @@ private slots:

QT_END_NAMESPACE

#endif // !defined(QT_NO_HTTP)

#endif
2 changes: 2 additions & 0 deletions src/network/access/qhttpmultipart.h
Expand Up @@ -46,6 +46,8 @@
#include <QtCore/QIODevice>
#include <QtNetwork/QNetworkRequest>

QT_REQUIRE_CONFIG(http);

QT_BEGIN_NAMESPACE


Expand Down
2 changes: 2 additions & 0 deletions src/network/access/qhttpmultipart_p.h
Expand Up @@ -56,6 +56,8 @@
#include "qnetworkrequest_p.h" // for deriving QHttpPartPrivate from QNetworkHeadersPrivate
#include "private/qobject_p.h"

QT_REQUIRE_CONFIG(http);

QT_BEGIN_NAMESPACE


Expand Down
4 changes: 0 additions & 4 deletions src/network/access/qhttpnetworkconnection.cpp
Expand Up @@ -53,8 +53,6 @@
#include <qpair.h>
#include <qdebug.h>

#ifndef QT_NO_HTTP

#ifndef QT_NO_SSL
# include <private/qsslsocket_p.h>
# include <QtNetwork/qsslkey.h>
Expand Down Expand Up @@ -1504,5 +1502,3 @@ void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpN
QT_END_NAMESPACE

#include "moc_qhttpnetworkconnection_p.cpp"

#endif // QT_NO_HTTP
4 changes: 1 addition & 3 deletions src/network/access/qhttpnetworkconnection_p.h
Expand Up @@ -70,7 +70,7 @@

#include <private/qhttpnetworkconnectionchannel_p.h>

#ifndef QT_NO_HTTP
QT_REQUIRE_CONFIG(http);

QT_BEGIN_NAMESPACE

Expand Down Expand Up @@ -287,6 +287,4 @@ class QHttpNetworkConnectionPrivate : public QObjectPrivate

QT_END_NAMESPACE

#endif // QT_NO_HTTP

#endif
4 changes: 0 additions & 4 deletions src/network/access/qhttpnetworkconnectionchannel.cpp
Expand Up @@ -45,8 +45,6 @@
#include <qpair.h>
#include <qdebug.h>

#ifndef QT_NO_HTTP

#include <private/qhttp2protocolhandler_p.h>
#include <private/qhttpprotocolhandler_p.h>
#include <private/qspdyprotocolhandler_p.h>
Expand Down Expand Up @@ -1239,5 +1237,3 @@ void QHttpNetworkConnectionChannel::setConnection(QHttpNetworkConnection *c)
QT_END_NAMESPACE

#include "moc_qhttpnetworkconnectionchannel_p.cpp"

#endif // QT_NO_HTTP
6 changes: 2 additions & 4 deletions src/network/access/qhttpnetworkconnectionchannel_p.h
Expand Up @@ -68,8 +68,6 @@
#include <private/qhttpnetworkconnection_p.h>
#include <private/qabstractprotocolhandler_p.h>

#ifndef QT_NO_HTTP

#ifndef QT_NO_SSL
# include <QtNetwork/qsslsocket.h>
# include <QtNetwork/qsslerror.h>
Expand All @@ -78,6 +76,8 @@
# include <QtNetwork/qtcpsocket.h>
#endif

QT_REQUIRE_CONFIG(http);

QT_BEGIN_NAMESPACE

class QHttpNetworkRequest;
Expand Down Expand Up @@ -213,6 +213,4 @@ class QHttpNetworkConnectionChannel : public QObject {

QT_END_NAMESPACE

#endif // QT_NO_HTTP

#endif
4 changes: 0 additions & 4 deletions src/network/access/qhttpnetworkheader.cpp
Expand Up @@ -41,8 +41,6 @@

#include <algorithm>

#ifndef QT_NO_HTTP

QT_BEGIN_NAMESPACE

QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QUrl &newUrl)
Expand Down Expand Up @@ -121,5 +119,3 @@ bool QHttpNetworkHeaderPrivate::operator==(const QHttpNetworkHeaderPrivate &othe


QT_END_NAMESPACE

#endif
8 changes: 2 additions & 6 deletions src/network/access/qhttpnetworkheader_p.h
Expand Up @@ -53,11 +53,11 @@

#include <QtNetwork/private/qtnetworkglobal_p.h>

#ifndef QT_NO_HTTP

#include <qshareddata.h>
#include <qurl.h>

QT_REQUIRE_CONFIG(http);

QT_BEGIN_NAMESPACE

class Q_AUTOTEST_EXPORT QHttpNetworkHeader
Expand Down Expand Up @@ -99,10 +99,6 @@ class QHttpNetworkHeaderPrivate : public QSharedData

QT_END_NAMESPACE


#endif // QT_NO_HTTP


#endif // QHTTPNETWORKHEADER_H


Expand Down
4 changes: 0 additions & 4 deletions src/network/access/qhttpnetworkreply.cpp
Expand Up @@ -40,8 +40,6 @@
#include "qhttpnetworkreply_p.h"
#include "qhttpnetworkconnection_p.h"

#ifndef QT_NO_HTTP

#ifndef QT_NO_SSL
# include <QtNetwork/qsslkey.h>
# include <QtNetwork/qsslcipher.h>
Expand Down Expand Up @@ -1035,5 +1033,3 @@ void QHttpNetworkReply::ignoreSslErrors(const QList<QSslError> &errors)


QT_END_NAMESPACE

#endif // QT_NO_HTTP
7 changes: 2 additions & 5 deletions src/network/access/qhttpnetworkreply_p.h
Expand Up @@ -53,8 +53,6 @@

#include <QtNetwork/private/qtnetworkglobal_p.h>

#ifndef QT_NO_HTTP

#include <qplatformdefs.h>

#ifndef QT_NO_COMPRESS
Expand All @@ -77,6 +75,8 @@ struct z_stream_s;
#include <private/qringbuffer_p.h>
#include <private/qbytedata_p.h>

QT_REQUIRE_CONFIG(http);

QT_BEGIN_NAMESPACE

class QHttpNetworkConnection;
Expand Down Expand Up @@ -285,7 +285,4 @@ class Q_AUTOTEST_EXPORT QHttpNetworkReplyPrivate : public QObjectPrivate, public

QT_END_NAMESPACE

#endif // QT_NO_HTTP


#endif // QHTTPNETWORKREPLY_H
4 changes: 0 additions & 4 deletions src/network/access/qhttpnetworkrequest.cpp
Expand Up @@ -40,8 +40,6 @@
#include "qhttpnetworkrequest_p.h"
#include "private/qnoncontiguousbytedevice_p.h"

#ifndef QT_NO_HTTP

QT_BEGIN_NAMESPACE

QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
Expand Down Expand Up @@ -383,5 +381,3 @@ int QHttpNetworkRequest::minorVersion() const

QT_END_NAMESPACE

#endif

7 changes: 2 additions & 5 deletions src/network/access/qhttpnetworkrequest_p.h
Expand Up @@ -52,12 +52,12 @@
//
#include <QtNetwork/private/qtnetworkglobal_p.h>

#ifndef QT_NO_HTTP

#include <private/qhttpnetworkheader_p.h>
#include <QtNetwork/qnetworkrequest.h>
#include <qmetatype.h>

QT_REQUIRE_CONFIG(http);

QT_BEGIN_NAMESPACE

class QNonContiguousByteDevice;
Expand Down Expand Up @@ -184,7 +184,4 @@ QT_END_NAMESPACE

Q_DECLARE_METATYPE(QHttpNetworkRequest)

#endif // QT_NO_HTTP


#endif // QHTTPNETWORKREQUEST_H
4 changes: 0 additions & 4 deletions src/network/access/qhttpprotocolhandler.cpp
Expand Up @@ -42,8 +42,6 @@
#include <private/qnoncontiguousbytedevice_p.h>
#include <private/qhttpnetworkconnectionchannel_p.h>

#ifndef QT_NO_HTTP

QT_BEGIN_NAMESPACE

QHttpProtocolHandler::QHttpProtocolHandler(QHttpNetworkConnectionChannel *channel)
Expand Down Expand Up @@ -437,5 +435,3 @@ bool QHttpProtocolHandler::sendRequest()
}

QT_END_NAMESPACE

#endif // QT_NO_HTTP

0 comments on commit eaa6eb5

Please sign in to comment.