Fix default "credential" flag for WASM HTTP connections

In some cases, you might want to set the "credentials" flag for HTTP
requests. But you can't use it everywhere, because it may break the
use of public APIs. As a result, you're running into

Reason: Credential is not supported if the CORS header
        'Access-Control-Allow-Origin' is '*'

on the client side. See

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSNotSupportingCredentials

for details.

This commit restores the former default "false", in order to make
WASM connections that worked prior 6.5 work again.

Fixes: QTBUG-112478
Pick-to: 6.5
Change-Id: I46f6a374c07038608c3484ac831a1dc5999fb120
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
Cajus Pollmeier 2023-03-31 14:26:09 +02:00
parent da2b0307f8
commit 59466abc08

View File

@ -282,10 +282,8 @@ void QNetworkReplyWasmImplPrivate::doSendRequest()
request.attribute(QNetworkRequest::CacheSaveControlAttribute, false).toBool()) {
attr.attributes -= EMSCRIPTEN_FETCH_PERSIST_FILE;
}
if (request.attribute(QNetworkRequest::UseCredentialsAttribute, true).toBool()) {
attr.withCredentials = true;
}
attr.withCredentials = request.attribute(QNetworkRequest::UseCredentialsAttribute, false).toBool();
attr.onsuccess = QNetworkReplyWasmImplPrivate::downloadSucceeded;
attr.onerror = QNetworkReplyWasmImplPrivate::downloadFailed;
attr.onprogress = QNetworkReplyWasmImplPrivate::downloadProgress;