From 44d4bc6d90442e1f82b8f921165360fecf3bed67 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Fri, 10 Jul 2020 08:52:16 +1000 Subject: wasm: fix setTransferTimeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WebAssembly does not need the http feature, but these functions were hidden behind that feature. Fixes: QTBUG-83867 Pick-to: 5.15 Change-Id: I7cd9aa73003f45ccbc2613c67c21e4067d6edddd Reviewed-by: Morten Johan Sørvig --- src/network/access/qnetworkaccessmanager.cpp | 2 +- src/network/access/qnetworkreplywasmimpl.cpp | 2 +- src/network/access/qnetworkrequest.cpp | 5 +++-- src/network/access/qnetworkrequest.h | 5 +++-- 4 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/network') diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 27801621db..b301dcd9b3 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1144,7 +1144,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, redirectPolicy()); } -#if QT_CONFIG(http) +#if QT_CONFIG(http) || defined (Q_OS_WASM) if (!req.transferTimeout()) req.setTransferTimeout(transferTimeout()); #endif diff --git a/src/network/access/qnetworkreplywasmimpl.cpp b/src/network/access/qnetworkreplywasmimpl.cpp index c2e66fea5b..1809672401 100644 --- a/src/network/access/qnetworkreplywasmimpl.cpp +++ b/src/network/access/qnetworkreplywasmimpl.cpp @@ -268,7 +268,7 @@ void QNetworkReplyWasmImplPrivate::doSendRequest() attr.onerror = QNetworkReplyWasmImplPrivate::downloadFailed; attr.onprogress = QNetworkReplyWasmImplPrivate::downloadProgress; attr.onreadystatechange = QNetworkReplyWasmImplPrivate::stateChange; - attr.timeoutMSecs = QNetworkRequest::DefaultTransferTimeoutConstant; + attr.timeoutMSecs = request.transferTimeout(); attr.userData = reinterpret_cast(this); QString dPath = QStringLiteral("/home/web_user/") + request.url().fileName(); diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index f8cb3feb69..46c4648cbe 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -905,7 +905,8 @@ void QNetworkRequest::setHttp2Configuration(const QHttp2Configuration &configura { d->h2Configuration = configuration; } - +#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC) +#if QT_CONFIG(http) || defined(Q_CLANG_QDOC) || defined (Q_OS_WASM) /*! \since 5.15 @@ -939,7 +940,7 @@ void QNetworkRequest::setTransferTimeout(int timeout) { d->transferTimeout = timeout; } -#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC) +#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC) || defined (Q_OS_WASM) static QByteArray headerName(QNetworkRequest::KnownHeaders header) { diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h index 035b5b378a..e0476d8036 100644 --- a/src/network/access/qnetworkrequest.h +++ b/src/network/access/qnetworkrequest.h @@ -180,10 +180,11 @@ public: #if QT_CONFIG(http) || defined(Q_CLANG_QDOC) QHttp2Configuration http2Configuration() const; void setHttp2Configuration(const QHttp2Configuration &configuration); - +#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC) +#if QT_CONFIG(http) || defined(Q_CLANG_QDOC) || defined (Q_OS_WASM) int transferTimeout() const; void setTransferTimeout(int timeout = DefaultTransferTimeoutConstant); -#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC) +#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC) || defined (Q_OS_WASM) private: QSharedDataPointer d; friend class QNetworkRequestPrivate; -- cgit v1.2.3