diff options
author | Lorn Potter <lorn.potter@gmail.com> | 2022-03-09 19:00:49 +1000 |
---|---|---|
committer | Lorn Potter <lorn.potter@gmail.com> | 2022-03-10 17:57:19 +1000 |
commit | 279b0ba6c469421b420294340766622b9dfa890a (patch) | |
tree | 6baa6189ab84a435ecd5c5160fad485e1a639242 /src | |
parent | e4419855341fce4d70b1fc2910df55832a4efd50 (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
Pick-to: 6.3 6.2 5.15
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
Diffstat (limited to 'src')
-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 d46c27e60a..0aaaa17b15 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()); } |