wasm: fix setTransferTimeout

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 <morten.sorvig@qt.io>
bb10
Lorn Potter 2020-07-10 08:52:16 +10:00
parent 762b5f09a6
commit 44d4bc6d90
4 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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<void *>(this);
QString dPath = QStringLiteral("/home/web_user/") + request.url().fileName();

View File

@ -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)
{

View File

@ -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<QNetworkRequestPrivate> d;
friend class QNetworkRequestPrivate;