Skip to content

Commit

Permalink
wasm: fix setTransferTimeout
Browse files Browse the repository at this point in the history
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 <[email protected]>
lpotter committed Jul 28, 2020
1 parent 762b5f0 commit 44d4bc6
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/network/access/qnetworkaccessmanager.cpp
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/network/access/qnetworkreplywasmimpl.cpp
Original file line number Diff line number Diff line change
@@ -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();
5 changes: 3 additions & 2 deletions src/network/access/qnetworkrequest.cpp
Original file line number Diff line number Diff line change
@@ -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)
{
5 changes: 3 additions & 2 deletions src/network/access/qnetworkrequest.h
Original file line number Diff line number Diff line change
@@ -180,10 +180,11 @@ class Q_NETWORK_EXPORT QNetworkRequest
#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;

0 comments on commit 44d4bc6

Please sign in to comment.