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>
This commit is contained in:
Lorn Potter 2022-03-09 19:00:49 +10:00
parent e441985534
commit 279b0ba6c4

View File

@ -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());
}