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.

Change-Id: I432fa3c78aa97b5ed2eb1027ac1dc3bdb134f9ba
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Ulf Hermann 2016-11-23 12:31:27 +01:00
parent ba3a26ea9f
commit 1a0b4b9f26
33 changed files with 101 additions and 126 deletions

View File

@ -1,14 +1,6 @@
# Qt network access module # Qt network access module
HEADERS += \ 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/qnetworkaccessauthenticationmanager_p.h \
access/qnetworkaccessmanager.h \ access/qnetworkaccessmanager.h \
access/qnetworkaccessmanager_p.h \ access/qnetworkaccessmanager_p.h \
@ -27,28 +19,15 @@ HEADERS += \
access/qnetworkreply_p.h \ access/qnetworkreply_p.h \
access/qnetworkreplyimpl_p.h \ access/qnetworkreplyimpl_p.h \
access/qnetworkreplydataimpl_p.h \ access/qnetworkreplydataimpl_p.h \
access/qnetworkreplyhttpimpl_p.h \
access/qnetworkreplyfileimpl_p.h \ access/qnetworkreplyfileimpl_p.h \
access/qabstractnetworkcache_p.h \ access/qabstractnetworkcache_p.h \
access/qabstractnetworkcache.h \ access/qabstractnetworkcache.h \
access/qhttpthreaddelegate_p.h \
access/qhttpmultipart.h \
access/qhttpmultipart_p.h \
access/qnetworkfile_p.h \ access/qnetworkfile_p.h \
access/qhttp2protocolhandler_p.h \
access/qhsts_p.h \ access/qhsts_p.h \
access/qhstspolicy.h \ access/qhstspolicy.h \
access/qhstsstore_p.h access/qhstsstore_p.h
SOURCES += \ 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/qnetworkaccessauthenticationmanager.cpp \
access/qnetworkaccessmanager.cpp \ access/qnetworkaccessmanager.cpp \
access/qnetworkaccesscache.cpp \ access/qnetworkaccesscache.cpp \
@ -62,13 +41,9 @@ SOURCES += \
access/qnetworkreply.cpp \ access/qnetworkreply.cpp \
access/qnetworkreplyimpl.cpp \ access/qnetworkreplyimpl.cpp \
access/qnetworkreplydataimpl.cpp \ access/qnetworkreplydataimpl.cpp \
access/qnetworkreplyhttpimpl.cpp \
access/qnetworkreplyfileimpl.cpp \ access/qnetworkreplyfileimpl.cpp \
access/qabstractnetworkcache.cpp \ access/qabstractnetworkcache.cpp \
access/qhttpthreaddelegate.cpp \
access/qhttpmultipart.cpp \
access/qnetworkfile.cpp \ access/qnetworkfile.cpp \
access/qhttp2protocolhandler.cpp \
access/qhsts.cpp \ access/qhsts.cpp \
access/qhstspolicy.cpp \ access/qhstspolicy.cpp \
access/qhstsstore.cpp access/qhstsstore.cpp
@ -94,4 +69,36 @@ qtConfig(networkdiskcache) {
mac: LIBS_PRIVATE += -framework Security mac: LIBS_PRIVATE += -framework Security
include($$PWD/../../3rdparty/zlib_dependency.pri) 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
}

View File

@ -62,6 +62,8 @@
#include <vector> #include <vector>
QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QNonContiguousByteDevice; class QNonContiguousByteDevice;

View File

@ -40,8 +40,6 @@
#include <private/qabstractprotocolhandler_p.h> #include <private/qabstractprotocolhandler_p.h>
#include <private/qhttpnetworkconnectionchannel_p.h> #include <private/qhttpnetworkconnectionchannel_p.h>
#ifndef QT_NO_HTTP
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QAbstractProtocolHandler::QAbstractProtocolHandler(QHttpNetworkConnectionChannel *channel) QAbstractProtocolHandler::QAbstractProtocolHandler(QHttpNetworkConnectionChannel *channel)
@ -62,5 +60,3 @@ void QAbstractProtocolHandler::setReply(QHttpNetworkReply *reply)
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP

View File

@ -53,7 +53,7 @@
#include <QtNetwork/private/qtnetworkglobal_p.h> #include <QtNetwork/private/qtnetworkglobal_p.h>
#ifndef QT_NO_HTTP QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -81,6 +81,4 @@ protected:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP
#endif // QABSTRACTPROTOCOLHANDLER_H #endif // QABSTRACTPROTOCOLHANDLER_H

View File

@ -40,8 +40,6 @@
#include "qhttpnetworkconnection_p.h" #include "qhttpnetworkconnection_p.h"
#include "qhttp2protocolhandler_p.h" #include "qhttp2protocolhandler_p.h"
#if !defined(QT_NO_HTTP)
#include "http2/bitstreams_p.h" #include "http2/bitstreams_p.h"
#include <private/qnoncontiguousbytedevice_p.h> #include <private/qnoncontiguousbytedevice_p.h>
@ -1483,5 +1481,3 @@ void QHttp2ProtocolHandler::closeSession()
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // !defined(QT_NO_HTTP)

View File

@ -55,8 +55,6 @@
#include <private/qabstractprotocolhandler_p.h> #include <private/qabstractprotocolhandler_p.h>
#include <private/qhttpnetworkrequest_p.h> #include <private/qhttpnetworkrequest_p.h>
#if !defined(QT_NO_HTTP)
#include "http2/http2protocol_p.h" #include "http2/http2protocol_p.h"
#include "http2/http2streams_p.h" #include "http2/http2streams_p.h"
#include "http2/http2frames_p.h" #include "http2/http2frames_p.h"
@ -75,6 +73,8 @@
#include <deque> #include <deque>
#include <set> #include <set>
QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QHttp2ProtocolHandler : public QObject, public QAbstractProtocolHandler class QHttp2ProtocolHandler : public QObject, public QAbstractProtocolHandler
@ -210,6 +210,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // !defined(QT_NO_HTTP)
#endif #endif

View File

@ -46,6 +46,8 @@
#include <QtCore/QIODevice> #include <QtCore/QIODevice>
#include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkRequest>
QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -56,6 +56,8 @@
#include "qnetworkrequest_p.h" // for deriving QHttpPartPrivate from QNetworkHeadersPrivate #include "qnetworkrequest_p.h" // for deriving QHttpPartPrivate from QNetworkHeadersPrivate
#include "private/qobject_p.h" #include "private/qobject_p.h"
QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -53,8 +53,6 @@
#include <qpair.h> #include <qpair.h>
#include <qdebug.h> #include <qdebug.h>
#ifndef QT_NO_HTTP
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
# include <private/qsslsocket_p.h> # include <private/qsslsocket_p.h>
# include <QtNetwork/qsslkey.h> # include <QtNetwork/qsslkey.h>
@ -1539,5 +1537,3 @@ void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpN
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qhttpnetworkconnection_p.cpp" #include "moc_qhttpnetworkconnection_p.cpp"
#endif // QT_NO_HTTP

View File

@ -70,7 +70,7 @@
#include <private/qhttpnetworkconnectionchannel_p.h> #include <private/qhttpnetworkconnectionchannel_p.h>
#ifndef QT_NO_HTTP QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -290,6 +290,4 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP
#endif #endif

View File

@ -45,8 +45,6 @@
#include <qpair.h> #include <qpair.h>
#include <qdebug.h> #include <qdebug.h>
#ifndef QT_NO_HTTP
#include <private/qhttp2protocolhandler_p.h> #include <private/qhttp2protocolhandler_p.h>
#include <private/qhttpprotocolhandler_p.h> #include <private/qhttpprotocolhandler_p.h>
#include <private/qspdyprotocolhandler_p.h> #include <private/qspdyprotocolhandler_p.h>
@ -1319,5 +1317,3 @@ void QHttpNetworkConnectionChannel::setConnection(QHttpNetworkConnection *c)
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qhttpnetworkconnectionchannel_p.cpp" #include "moc_qhttpnetworkconnectionchannel_p.cpp"
#endif // QT_NO_HTTP

View File

@ -68,8 +68,6 @@
#include <private/qhttpnetworkconnection_p.h> #include <private/qhttpnetworkconnection_p.h>
#include <private/qabstractprotocolhandler_p.h> #include <private/qabstractprotocolhandler_p.h>
#ifndef QT_NO_HTTP
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
# include <QtNetwork/qsslsocket.h> # include <QtNetwork/qsslsocket.h>
# include <QtNetwork/qsslerror.h> # include <QtNetwork/qsslerror.h>
@ -80,6 +78,8 @@
#include <QtCore/qscopedpointer.h> #include <QtCore/qscopedpointer.h>
QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QHttpNetworkRequest; class QHttpNetworkRequest;
@ -216,6 +216,4 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP
#endif #endif

View File

@ -41,8 +41,6 @@
#include <algorithm> #include <algorithm>
#ifndef QT_NO_HTTP
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QUrl &newUrl) QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QUrl &newUrl)
@ -121,5 +119,3 @@ bool QHttpNetworkHeaderPrivate::operator==(const QHttpNetworkHeaderPrivate &othe
QT_END_NAMESPACE QT_END_NAMESPACE
#endif

View File

@ -53,11 +53,11 @@
#include <QtNetwork/private/qtnetworkglobal_p.h> #include <QtNetwork/private/qtnetworkglobal_p.h>
#ifndef QT_NO_HTTP
#include <qshareddata.h> #include <qshareddata.h>
#include <qurl.h> #include <qurl.h>
QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class Q_AUTOTEST_EXPORT QHttpNetworkHeader class Q_AUTOTEST_EXPORT QHttpNetworkHeader
@ -99,10 +99,6 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP
#endif // QHTTPNETWORKHEADER_H #endif // QHTTPNETWORKHEADER_H

View File

@ -40,8 +40,6 @@
#include "qhttpnetworkreply_p.h" #include "qhttpnetworkreply_p.h"
#include "qhttpnetworkconnection_p.h" #include "qhttpnetworkconnection_p.h"
#ifndef QT_NO_HTTP
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
# include <QtNetwork/qsslkey.h> # include <QtNetwork/qsslkey.h>
# include <QtNetwork/qsslcipher.h> # include <QtNetwork/qsslcipher.h>
@ -1035,5 +1033,3 @@ void QHttpNetworkReply::ignoreSslErrors(const QList<QSslError> &errors)
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP

View File

@ -53,8 +53,6 @@
#include <QtNetwork/private/qtnetworkglobal_p.h> #include <QtNetwork/private/qtnetworkglobal_p.h>
#ifndef QT_NO_HTTP
#include <qplatformdefs.h> #include <qplatformdefs.h>
#ifndef QT_NO_COMPRESS #ifndef QT_NO_COMPRESS
@ -77,6 +75,8 @@ struct z_stream_s;
#include <private/qringbuffer_p.h> #include <private/qringbuffer_p.h>
#include <private/qbytedata_p.h> #include <private/qbytedata_p.h>
QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QHttpNetworkConnection; class QHttpNetworkConnection;
@ -285,7 +285,4 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP
#endif // QHTTPNETWORKREPLY_H #endif // QHTTPNETWORKREPLY_H

View File

@ -40,8 +40,6 @@
#include "qhttpnetworkrequest_p.h" #include "qhttpnetworkrequest_p.h"
#include "private/qnoncontiguousbytedevice_p.h" #include "private/qnoncontiguousbytedevice_p.h"
#ifndef QT_NO_HTTP
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op, QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
@ -395,5 +393,3 @@ int QHttpNetworkRequest::minorVersion() const
QT_END_NAMESPACE QT_END_NAMESPACE
#endif

View File

@ -52,12 +52,12 @@
// //
#include <QtNetwork/private/qtnetworkglobal_p.h> #include <QtNetwork/private/qtnetworkglobal_p.h>
#ifndef QT_NO_HTTP
#include <private/qhttpnetworkheader_p.h> #include <private/qhttpnetworkheader_p.h>
#include <QtNetwork/qnetworkrequest.h> #include <QtNetwork/qnetworkrequest.h>
#include <qmetatype.h> #include <qmetatype.h>
QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QNonContiguousByteDevice; class QNonContiguousByteDevice;
@ -188,7 +188,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QHttpNetworkRequest) Q_DECLARE_METATYPE(QHttpNetworkRequest)
#endif // QT_NO_HTTP
#endif // QHTTPNETWORKREQUEST_H #endif // QHTTPNETWORKREQUEST_H

View File

@ -42,8 +42,6 @@
#include <private/qnoncontiguousbytedevice_p.h> #include <private/qnoncontiguousbytedevice_p.h>
#include <private/qhttpnetworkconnectionchannel_p.h> #include <private/qhttpnetworkconnectionchannel_p.h>
#ifndef QT_NO_HTTP
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QHttpProtocolHandler::QHttpProtocolHandler(QHttpNetworkConnectionChannel *channel) QHttpProtocolHandler::QHttpProtocolHandler(QHttpNetworkConnectionChannel *channel)
@ -437,5 +435,3 @@ bool QHttpProtocolHandler::sendRequest()
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP

View File

@ -55,7 +55,7 @@
#include <QtNetwork/private/qtnetworkglobal_p.h> #include <QtNetwork/private/qtnetworkglobal_p.h>
#include <private/qabstractprotocolhandler_p.h> #include <private/qabstractprotocolhandler_p.h>
#ifndef QT_NO_HTTP QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -71,6 +71,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP
#endif #endif

View File

@ -50,8 +50,6 @@
#include "private/qnetworkaccesscache_p.h" #include "private/qnetworkaccesscache_p.h"
#include "private/qnoncontiguousbytedevice_p.h" #include "private/qnoncontiguousbytedevice_p.h"
#ifndef QT_NO_HTTP
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url) static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url)
@ -765,6 +763,4 @@ void QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot(const QNet
#endif #endif
#endif // QT_NO_HTTP
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -67,7 +67,7 @@
#include "private/qnoncontiguousbytedevice_p.h" #include "private/qnoncontiguousbytedevice_p.h"
#include "qnetworkaccessauthenticationmanager_p.h" #include "qnetworkaccessauthenticationmanager_p.h"
#ifndef QT_NO_HTTP QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -325,6 +325,4 @@ signals:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP
#endif // QHTTPTHREADDELEGATE_H #endif // QHTTPTHREADDELEGATE_H

View File

@ -66,10 +66,12 @@
#include "QtNetwork/private/qauthenticator_p.h" #include "QtNetwork/private/qauthenticator_p.h"
#include "QtNetwork/qsslconfiguration.h" #include "QtNetwork/qsslconfiguration.h"
#include "QtNetwork/qnetworkconfigmanager.h" #include "QtNetwork/qnetworkconfigmanager.h"
#include "QtNetwork/qhttpmultipart.h"
#include "qhttpmultipart_p.h"
#if QT_CONFIG(http)
#include "qhttpmultipart.h"
#include "qhttpmultipart_p.h"
#include "qnetworkreplyhttpimpl_p.h" #include "qnetworkreplyhttpimpl_p.h"
#endif
#include "qthread.h" #include "qthread.h"
@ -469,7 +471,7 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent)
qRegisterMetaType<QSslPreSharedKeyAuthenticator *>(); qRegisterMetaType<QSslPreSharedKeyAuthenticator *>();
#endif #endif
qRegisterMetaType<QList<QPair<QByteArray,QByteArray> > >(); qRegisterMetaType<QList<QPair<QByteArray,QByteArray> > >();
#ifndef QT_NO_HTTP #if QT_CONFIG(http)
qRegisterMetaType<QHttpNetworkRequest>(); qRegisterMetaType<QHttpNetworkRequest>();
#endif #endif
qRegisterMetaType<QNetworkReply::NetworkError>(); qRegisterMetaType<QNetworkReply::NetworkError>();
@ -877,6 +879,7 @@ QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, const
return reply; return reply;
} }
#if QT_CONFIG(http)
/*! /*!
\since 4.8 \since 4.8
@ -916,6 +919,7 @@ QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, QHttpM
QNetworkReply *reply = put(newRequest, device); QNetworkReply *reply = put(newRequest, device);
return reply; return reply;
} }
#endif // QT_CONFIG(http)
/*! /*!
Uploads the contents of \a data to the destination \a request and Uploads the contents of \a data to the destination \a request and
@ -1285,6 +1289,7 @@ QNetworkReply *QNetworkAccessManager::sendCustomRequest(const QNetworkRequest &r
return reply; return reply;
} }
#if QT_CONFIG(http)
/*! /*!
\since 5.8 \since 5.8
@ -1306,6 +1311,7 @@ QNetworkReply *QNetworkAccessManager::sendCustomRequest(const QNetworkRequest &r
QNetworkReply *reply = sendCustomRequest(newRequest, verb, device); QNetworkReply *reply = sendCustomRequest(newRequest, verb, device);
return reply; return reply;
} }
#endif // QT_CONFIG(http)
/*! /*!
Returns a new QNetworkReply object to handle the operation \a op Returns a new QNetworkReply object to handle the operation \a op
@ -1419,7 +1425,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
} }
} }
#ifndef QT_NO_HTTP #if QT_CONFIG(http)
// Since Qt 5 we use the new QNetworkReplyHttpImpl // Since Qt 5 we use the new QNetworkReplyHttpImpl
if (scheme == QLatin1String("http") || scheme == QLatin1String("preconnect-http") if (scheme == QLatin1String("http") || scheme == QLatin1String("preconnect-http")
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
@ -1451,7 +1457,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
#endif #endif
return reply; return reply;
} }
#endif // QT_NO_HTTP #endif // QT_CONFIG(http)
// first step: create the reply // first step: create the reply
QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); QNetworkReplyImpl *reply = new QNetworkReplyImpl(this);
@ -1527,7 +1533,7 @@ QStringList QNetworkAccessManager::supportedSchemesImplementation() const
QStringList schemes = d->backendSupportedSchemes(); QStringList schemes = d->backendSupportedSchemes();
// Those ones don't exist in backends // Those ones don't exist in backends
#ifndef QT_NO_HTTP #if QT_CONFIG(http)
schemes << QStringLiteral("http"); schemes << QStringLiteral("http");
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
if (QSslSocket::supportsSsl()) if (QSslSocket::supportsSsl())
@ -1992,6 +1998,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionFailed(QNetworkSession::Sess
#endif // QT_NO_BEARERMANAGEMENT #endif // QT_NO_BEARERMANAGEMENT
#if QT_CONFIG(http)
QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart) QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart)
{ {
// copy the request, we probably need to add some headers // copy the request, we probably need to add some headers
@ -2039,6 +2046,7 @@ QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkReq
return newRequest; return newRequest;
} }
#endif // QT_CONFIG(http)
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -134,14 +134,17 @@ public:
QNetworkReply *get(const QNetworkRequest &request); QNetworkReply *get(const QNetworkRequest &request);
QNetworkReply *post(const QNetworkRequest &request, QIODevice *data); QNetworkReply *post(const QNetworkRequest &request, QIODevice *data);
QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data); QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data);
QNetworkReply *post(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *put(const QNetworkRequest &request, QIODevice *data); QNetworkReply *put(const QNetworkRequest &request, QIODevice *data);
QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data); QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data);
QNetworkReply *put(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *deleteResource(const QNetworkRequest &request); QNetworkReply *deleteResource(const QNetworkRequest &request);
QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data = nullptr); QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data = nullptr);
QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, const QByteArray &data); QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, const QByteArray &data);
#if QT_CONFIG(http)
QNetworkReply *post(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *put(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QHttpMultiPart *multiPart); QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QHttpMultiPart *multiPart);
#endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT
void setConfiguration(const QNetworkConfiguration &config); void setConfiguration(const QNetworkConfiguration &config);

View File

@ -164,7 +164,9 @@ public:
#endif #endif
#if QT_CONFIG(http)
QNetworkRequest prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart); QNetworkRequest prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart);
#endif
// this is the cache for storing downloaded files // this is the cache for storing downloaded files
QAbstractNetworkCache *networkCache; QAbstractNetworkCache *networkCache;

View File

@ -60,8 +60,6 @@
#include "qnetworkcookiejar.h" #include "qnetworkcookiejar.h"
#ifndef QT_NO_HTTP
#include <string.h> // for strchr #include <string.h> // for strchr
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -2381,5 +2379,3 @@ void QNetworkReplyHttpImplPrivate::completeCacheSave()
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP

View File

@ -72,7 +72,7 @@
#include <QtNetwork/QSslConfiguration> #include <QtNetwork/QSslConfiguration>
#endif #endif
#ifndef QT_NO_HTTP QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -315,6 +315,4 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_HTTP
#endif #endif

View File

@ -43,7 +43,7 @@
#include <private/qhttpnetworkconnectionchannel_p.h> #include <private/qhttpnetworkconnectionchannel_p.h>
#include <QtCore/QtEndian> #include <QtCore/QtEndian>
#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL) #if !defined(QT_NO_SSL)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -1294,4 +1294,4 @@ qint32 QSpdyProtocolHandler::generateNextStreamID()
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL) #endif // !defined(QT_NO_SSL)

View File

@ -58,7 +58,9 @@
#include <zlib.h> #include <zlib.h>
#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL) QT_REQUIRE_CONFIG(http);
#if !defined(QT_NO_SSL)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -223,6 +225,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::SETTINGS_ID_Flags)
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL) #endif // !defined(QT_NO_SSL)
#endif // QSPDYPROTOCOLHANDLER_H #endif // QSPDYPROTOCOLHANDLER_H

View File

@ -230,7 +230,11 @@
#if QT_CONFIG(socks5) #if QT_CONFIG(socks5)
#include "private/qsocks5socketengine_p.h" #include "private/qsocks5socketengine_p.h"
#endif #endif
#if QT_CONFIG(http)
#include "private/qhttpsocketengine_p.h" #include "private/qhttpsocketengine_p.h"
#endif
#include "qauthenticator.h" #include "qauthenticator.h"
#include "qdebug.h" #include "qdebug.h"
#include "qmutex.h" #include "qmutex.h"
@ -256,7 +260,7 @@ public:
#if QT_CONFIG(socks5) #if QT_CONFIG(socks5)
, socks5SocketEngineHandler(0) , socks5SocketEngineHandler(0)
#endif #endif
#ifndef QT_NO_HTTP #if QT_CONFIG(http)
, httpSocketEngineHandler(0) , httpSocketEngineHandler(0)
#endif #endif
#ifdef QT_USE_SYSTEM_PROXIES #ifdef QT_USE_SYSTEM_PROXIES
@ -268,7 +272,7 @@ public:
#if QT_CONFIG(socks5) #if QT_CONFIG(socks5)
socks5SocketEngineHandler = new QSocks5SocketEngineHandler(); socks5SocketEngineHandler = new QSocks5SocketEngineHandler();
#endif #endif
#ifndef QT_NO_HTTP #if QT_CONFIG(http)
httpSocketEngineHandler = new QHttpSocketEngineHandler(); httpSocketEngineHandler = new QHttpSocketEngineHandler();
#endif #endif
} }
@ -280,7 +284,7 @@ public:
#if QT_CONFIG(socks5) #if QT_CONFIG(socks5)
delete socks5SocketEngineHandler; delete socks5SocketEngineHandler;
#endif #endif
#ifndef QT_NO_HTTP #if QT_CONFIG(http)
delete httpSocketEngineHandler; delete httpSocketEngineHandler;
#endif #endif
} }
@ -340,7 +344,7 @@ private:
#if QT_CONFIG(socks5) #if QT_CONFIG(socks5)
QSocks5SocketEngineHandler *socks5SocketEngineHandler; QSocks5SocketEngineHandler *socks5SocketEngineHandler;
#endif #endif
#ifndef QT_NO_HTTP #if QT_CONFIG(http)
QHttpSocketEngineHandler *httpSocketEngineHandler; QHttpSocketEngineHandler *httpSocketEngineHandler;
#endif #endif
bool useSystemProxies; bool useSystemProxies;

View File

@ -46,7 +46,7 @@
#include "qelapsedtimer.h" #include "qelapsedtimer.h"
#include "qnetworkinterface.h" #include "qnetworkinterface.h"
#if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP) #if !defined(QT_NO_NETWORKPROXY)
#include <qdebug.h> #include <qdebug.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -866,4 +866,4 @@ QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(qintptr, QOb
QT_END_NAMESPACE QT_END_NAMESPACE
#endif #endif // !QT_NO_NETWORKPROXY

View File

@ -57,9 +57,11 @@
#include "qnetworkproxy.h" #include "qnetworkproxy.h"
#include "private/qauthenticator_p.h" #include "private/qauthenticator_p.h"
QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP) #if !defined(QT_NO_NETWORKPROXY)
class QTcpSocket; class QTcpSocket;
class QHttpNetworkReply; class QHttpNetworkReply;

View File

@ -1,7 +1,6 @@
# Qt network socket # Qt network socket
HEADERS += socket/qabstractsocketengine_p.h \ HEADERS += socket/qabstractsocketengine_p.h \
socket/qhttpsocketengine_p.h \
socket/qabstractsocket.h \ socket/qabstractsocket.h \
socket/qabstractsocket_p.h \ socket/qabstractsocket_p.h \
socket/qtcpsocket.h \ socket/qtcpsocket.h \
@ -11,7 +10,6 @@ HEADERS += socket/qabstractsocketengine_p.h \
socket/qtcpserver_p.h socket/qtcpserver_p.h
SOURCES += socket/qabstractsocketengine.cpp \ SOURCES += socket/qabstractsocketengine.cpp \
socket/qhttpsocketengine.cpp \
socket/qabstractsocket.cpp \ socket/qabstractsocket.cpp \
socket/qtcpsocket.cpp \ socket/qtcpsocket.cpp \
socket/qudpsocket.cpp \ socket/qudpsocket.cpp \
@ -26,6 +24,13 @@ qtConfig(socks5) {
socket/qsocks5socketengine.cpp socket/qsocks5socketengine.cpp
} }
qtConfig(http) {
HEADERS += \
socket/qhttpsocketengine_p.h
SOURCES += \
socket/qhttpsocketengine.cpp
}
# SCTP support. # SCTP support.
qtConfig(sctp) { qtConfig(sctp) {