diff options
author | Lorn Potter <lorn.potter@gmail.com> | 2022-03-09 19:00:49 +1000 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-03-10 08:23:48 +0000 |
commit | ba62f9ebd337a70878be616a4a88fead4c575f0f (patch) | |
tree | 22cf1bf1c01cbd7d0b246b6e0d853a35ed2c87e8 | |
parent | b9208b91c83b5dfba796d1d1dff4c7b6b200453e (diff) |
wasm: fix issue with passing username/password to network request
The data scope was wrong, it needs to live beyond the attribute strut
Change-Id: If1ceb4967fc1755d4968a69bcd9d82b234bd871d
Done-with: Vincent Rouillé
Fixes: QTBUG-101551
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
(cherry picked from commit 279b0ba6c469421b420294340766622b9dfa890a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/network/access/qnetworkreplywasmimpl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/network/access/qnetworkreplywasmimpl.cpp b/src/network/access/qnetworkreplywasmimpl.cpp index 95cb94b2b0..65214b8eb9 100644 --- a/src/network/access/qnetworkreplywasmimpl.cpp +++ b/src/network/access/qnetworkreplywasmimpl.cpp @@ -234,10 +234,13 @@ void QNetworkReplyWasmImplPrivate::doSendRequest() } } + QByteArray userName, password; // username & password if (!request.url().userInfo().isEmpty()) { - attr.userName = request.url().userName().toUtf8(); - attr.password = request.url().password().toUtf8(); + userName = request.url().userName().toUtf8(); + password = request.url().password().toUtf8(); + attr.userName = userName.constData(); + attr.password = password.constData(); } attr.attributes = EMSCRIPTEN_FETCH_LOAD_TO_MEMORY; @@ -265,7 +268,8 @@ void QNetworkReplyWasmImplPrivate::doSendRequest() attr.userData = reinterpret_cast<void *>(this); QString dPath = QStringLiteral("/home/web_user/") + request.url().fileName(); - attr.destinationPath = dPath.toUtf8(); + QByteArray destinationPath = dPath.toUtf8(); + attr.destinationPath = destinationPath.constData(); m_fetch = emscripten_fetch(&attr, request.url().toString().toUtf8()); } |